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
This commit is contained in:
KongQun Yang 2019-04-23 10:35:30 -07:00
parent b85e5c9368
commit 4b8e9a662f
3 changed files with 5 additions and 7 deletions

View File

@ -1,7 +1,7 @@
#EXTM3U
## Generated with https://github.com/google/shaka-packager version <tag>-<hash>-<test>
#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"

View File

@ -4,7 +4,7 @@
<Period id="0" duration="PT2.002S">
<AdaptationSet id="0" contentType="text" segmentAlignment="true">
<Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
<Representation id="0" bandwidth="1896000" codecs="wvtt" mimeType="application/mp4">
<Representation id="0" bandwidth="1912" codecs="wvtt" mimeType="application/mp4">
<SegmentTemplate timescale="1000" initialization="bear-english-text-init.mp4" media="bear-english-text-$Number$.m4s" startNumber="1">
<SegmentTimeline>
<S t="0" d="1000" r="1"/>

View File

@ -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;