Skip to content

Commit

Permalink
feat: add m2ts_offset_ms to LiveConfig (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenda6 authored Jan 22, 2024
1 parent ad7c899 commit 90cb6cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
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

0 comments on commit 90cb6cf

Please sign in to comment.