diff --git a/include/packager/live_packager.h b/include/packager/live_packager.h index ad749fab4a6..0665ab4af3c 100644 --- a/include/packager/live_packager.h +++ b/include/packager/live_packager.h @@ -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 { diff --git a/packager/live_packager.cc b/packager/live_packager.cc index b07256a031e..7e9291d46c2 100644 --- a/packager/live_packager.cc +++ b/packager/live_packager.cc @@ -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; @@ -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