[vlc-devel] [PATCH 1/2] demux: adaptive: fix incorrect segment duration
Zhao Zhili
quinkblack at foxmail.com
Sat Nov 4 04:08:55 CET 2017
ping for review.
于 2017年11月3日 GMT+08:00 上午9:32:26, Zhao Zhili <quinkblack at foxmail.com> 写到:
>It's supposed to return the duration of the current segment, not the
>previous segment.
>---
> modules/demux/adaptive/playlist/SegmentList.cpp | 30
>++++++++++++++-----------
> 1 file changed, 17 insertions(+), 13 deletions(-)
>
>diff --git a/modules/demux/adaptive/playlist/SegmentList.cpp
>b/modules/demux/adaptive/playlist/SegmentList.cpp
>index 59755da..415a37c 100644
>--- a/modules/demux/adaptive/playlist/SegmentList.cpp
>+++ b/modules/demux/adaptive/playlist/SegmentList.cpp
>@@ -152,29 +152,33 @@ bool
>SegmentList::getPlaybackTimeDurationBySegmentNumber(uint64_t number,
> if(first->getSequenceNumber() > number)
> return false;
>
>- *time = first->startTime.Get();
>+ bool found = false;
>+ stime_t seg_start = first->startTime.Get();
>+ stime_t seg_dura = 0;
> std::vector<ISegment *>::const_iterator it = segments.begin();
> for(it = segments.begin(); it != segments.end(); ++it)
> {
> const ISegment *seg = *it;
>+
>+ if(seg->duration.Get())
>+ seg_dura = seg->duration.Get();
>+ else
>+ seg_dura = duration.Get();
>+
> /* Assuming there won't be any discontinuity in sequence */
> if(seg->getSequenceNumber() == number)
> {
>+ found = true;
> break;
> }
>- else if(seg->duration.Get())
>- {
>- *time += seg->duration.Get();
>- *dur = seg->duration.Get();
>- }
>- else
>- {
>- *time += duration.Get();
>- *dur = duration.Get();
>- }
>+
>+ seg_start += seg_dura;
> }
>
>- *time = VLC_TS_0 + timescale.ToTime( *time );
>- *dur = VLC_TS_0 + timescale.ToTime( *dur );
>+ if(!found)
>+ return false;
>+
>+ *time = VLC_TS_0 + timescale.ToTime(seg_start);
>+ *dur = VLC_TS_0 + timescale.ToTime(seg_dura);
> return true;
> }
>--
>2.7.4
--
使用 K-9 Mail 发送自我的Android设备。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20171104/52913591/attachment.html>
More information about the vlc-devel
mailing list