Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add m2ts_offset_ms to LiveConfig #15

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/packager/live_packager.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ struct LiveConfig {
/// For M2TS output:
/// It is be used to set the continuity counter (TODO: UNIMPLEMENTED).
uint32_t segment_number = 0;

/// The offset to be applied to transport stream (e.g. MPEG2-TS, HLS packed
/// audio) timestamps to compensate for possible negative timestamps in the
/// input.
int32_t m2ts_offset_ms = 0;
};

class LivePackager {
Expand Down
4 changes: 4 additions & 0 deletions packager/live_packager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ Status LivePackager::PackageInit(const Segment& init_segment,
DEFAULT_SEGMENT_DURATION;

packaging_params.mp4_output_params.include_pssh_in_stream = false;
packaging_params.transport_stream_timestamp_offset_ms =
config_.m2ts_offset_ms;

// in order to enable init packaging as a separate execution.
packaging_params.init_segment_only = true;
Expand Down Expand Up @@ -325,6 +327,8 @@ Status LivePackager::Package(const Segment& init_segment,

packaging_params.mp4_output_params.sequence_number = config_.segment_number;
packaging_params.mp4_output_params.include_pssh_in_stream = false;
packaging_params.transport_stream_timestamp_offset_ms =
config_.m2ts_offset_ms;

EncryptionParams& encryption_params = packaging_params.encryption_params;
// As a side effect of InitializeEncryption, encryption_params will be
Expand Down