diff --git a/include/packager/live_packager.h b/include/packager/live_packager.h index 8ce80d46251..a96b9735fa1 100644 --- a/include/packager/live_packager.h +++ b/include/packager/live_packager.h @@ -78,8 +78,6 @@ struct LiveConfig { OutputFormat format; TrackType track_type; - // TOOD: do we need non-integer durations? - double segment_duration_sec; // TODO: should we allow for keys to be hex string? std::vector iv; diff --git a/packager/live_packager.cc b/packager/live_packager.cc index 036b49ff7fa..70eb78518fa 100644 --- a/packager/live_packager.cc +++ b/packager/live_packager.cc @@ -25,6 +25,10 @@ namespace { using StreamDescriptors = std::vector; +// Shaka requires a non-zero value for segment duration otherwise it throws an error. +// For our use-case of packaging segments individually, this value has no effect. +constexpr double DEFAULT_SEGMENT_DURATION = 5.0; + const std::string INPUT_FNAME = "memory://input_file"; const std::string INIT_SEGMENT_FNAME = "init.mp4"; @@ -247,7 +251,7 @@ Status LivePackager::PackageInit(const Segment& init_segment, shaka::PackagingParams packaging_params; packaging_params.chunking_params.segment_duration_in_seconds = - config_.segment_duration_sec; + DEFAULT_SEGMENT_DURATION; // in order to enable init packaging as a separate execution. packaging_params.init_segment_only = true; @@ -306,7 +310,7 @@ Status LivePackager::Package(const Segment& init_segment, shaka::PackagingParams packaging_params; packaging_params.chunking_params.segment_duration_in_seconds = - config_.segment_duration_sec; + DEFAULT_SEGMENT_DURATION; packaging_params.mp4_output_params.sequence_number = config_.segment_number; diff --git a/packager/live_packager_test.cc b/packager/live_packager_test.cc index acabc144f61..a6d390cc315 100644 --- a/packager/live_packager_test.cc +++ b/packager/live_packager_test.cc @@ -35,7 +35,6 @@ const uint8_t kIv[]{ 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, }; -const double kSegmentDurationInSeconds = 5.0; const int kNumSegments = 10; std::filesystem::path GetTestDataFilePath(const std::string& name) { @@ -246,7 +245,6 @@ class LivePackagerBaseTest : public ::testing::Test { void SetupLivePackagerConfig(const LiveConfig& config) { LiveConfig new_live_config = config; - new_live_config.segment_duration_sec = kSegmentDurationInSeconds; switch (new_live_config.protection_scheme) { case LiveConfig::EncryptionScheme::NONE: break; @@ -369,7 +367,6 @@ TEST_F(LivePackagerBaseTest, CustomMoofSequenceNumber) { live_config.format = LiveConfig::OutputFormat::FMP4; live_config.track_type = LiveConfig::TrackType::VIDEO; live_config.protection_scheme = LiveConfig::EncryptionScheme::NONE; - live_config.segment_duration_sec = kSegmentDurationInSeconds; for (unsigned int i = 0; i < kNumSegments; i++) { live_config.segment_number = i + 1;