From 4b8e9a662f755c22ce540c8e3c76869f3c6d5ded Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Tue, 23 Apr 2019 10:35:30 -0700 Subject: [PATCH] Fix problems that target duration is not set in mpd/hls params We have logics in bandwidth calculation to ignore segments that is smaller than half of target duration. The logic does not have any effect right now as the target duration in mpd/hls params is always zero. This change will set target duration in mpd/hls params, thus it can fix part of issue #581 as the last segment which is less than half of target duration. Issue #581. Fixes #498. Change-Id: Ieb2dbf4da9fc72a7b9de802cda4294f1954d29b4 --- .../output.m3u8 | 4 ++-- .../test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd | 2 +- packager/packager.cc | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/packager/app/test/testdata/avc-ts-with-encryption-exercise-emulation-prevention/output.m3u8 b/packager/app/test/testdata/avc-ts-with-encryption-exercise-emulation-prevention/output.m3u8 index 8860f9a75f..12ee20533f 100644 --- a/packager/app/test/testdata/avc-ts-with-encryption-exercise-emulation-prevention/output.m3u8 +++ b/packager/app/test/testdata/avc-ts-with-encryption-exercise-emulation-prevention/output.m3u8 @@ -1,7 +1,7 @@ #EXTM3U ## Generated with https://github.com/google/shaka-packager version -- -#EXT-X-STREAM-INF:BANDWIDTH=1183949,AVERAGE-BANDWIDTH=390288,CODECS="avc1.64001f",RESOLUTION=1024x436 +#EXT-X-STREAM-INF:BANDWIDTH=863296,AVERAGE-BANDWIDTH=390288,CODECS="avc1.64001f",RESOLUTION=1024x436 sintel-1024x436-video.m3u8 -#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=447591,AVERAGE-BANDWIDTH=40358,CODECS="avc1.64001f",RESOLUTION=1024x436,URI="sintel-1024x436-video-iframe.m3u8" +#EXT-X-I-FRAME-STREAM-INF:BANDWIDTH=88736,AVERAGE-BANDWIDTH=40358,CODECS="avc1.64001f",RESOLUTION=1024x436,URI="sintel-1024x436-video-iframe.m3u8" diff --git a/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd b/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd index a365052883..fa415453e9 100644 --- a/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd +++ b/packager/app/test/testdata/vtt-text-to-mp4-with-ad-cues/output.mpd @@ -4,7 +4,7 @@ - + diff --git a/packager/packager.cc b/packager/packager.cc index 5f9c400364..d7d4d42689 100644 --- a/packager/packager.cc +++ b/packager/packager.cc @@ -899,10 +899,8 @@ Status Packager::Initialize( // DASH approximate segment timeline. const double target_segment_duration = packaging_params.chunking_params.segment_duration_in_seconds; - if (mpd_params.target_segment_duration != 0) - mpd_params.target_segment_duration = target_segment_duration; - if (hls_params.target_segment_duration != 0) - hls_params.target_segment_duration = target_segment_duration; + mpd_params.target_segment_duration = target_segment_duration; + hls_params.target_segment_duration = target_segment_duration; // Store callback params to make it available during packaging. internal->buffer_callback_params = packaging_params.buffer_callback_params;