[vlc-commits] demux: adaptive: return correct live time on stream change
Francois Cartegnie
git at videolan.org
Mon Jan 16 20:49:49 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jan 16 17:15:24 2017 +0100| [cddfff8499683a7db1dcf1740988661b4cf4a9f5] | committer: Francois Cartegnie
demux: adaptive: return correct live time on stream change
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cddfff8499683a7db1dcf1740988661b4cf4a9f5
---
modules/demux/adaptive/playlist/SegmentInformation.cpp | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/demux/adaptive/playlist/SegmentInformation.cpp b/modules/demux/adaptive/playlist/SegmentInformation.cpp
index d55c199..10ccc7e 100644
--- a/modules/demux/adaptive/playlist/SegmentInformation.cpp
+++ b/modules/demux/adaptive/playlist/SegmentInformation.cpp
@@ -343,12 +343,18 @@ bool SegmentInformation::getSegmentNumberByTime(mtime_t time, uint64_t *ret) con
return true;
}
- /* Note: incorrect for live */
const stime_t duration = mediaSegmentTemplate->duration.Get();
- *ret = mediaSegmentTemplate->startNumber.Get();
- if(duration)
+ if( duration )
{
- *ret += timescale.ToScaled(time) / duration;
+ if( getPlaylist()->isLive() )
+ {
+ *ret = getLiveStartSegmentNumber( mediaSegmentTemplate->startNumber.Get() );
+ }
+ else
+ {
+ *ret = mediaSegmentTemplate->startNumber.Get();
+ *ret += timescale.ToScaled(time) / duration;
+ }
return true;
}
}
More information about the vlc-commits
mailing list