[vlc-commits] demux: adaptive: fix segment compare
Zhao Zhili
git at videolan.org
Mon Dec 18 22:17:51 CET 2017
vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Sat Dec 16 23:12:41 2017 +0800| [ed414dc3b31cfa3c843cacbc496ee5fef9f94713] | committer: Francois Cartegnie
demux: adaptive: fix segment compare
Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed414dc3b31cfa3c843cacbc496ee5fef9f94713
---
modules/demux/adaptive/playlist/Segment.cpp | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/modules/demux/adaptive/playlist/Segment.cpp b/modules/demux/adaptive/playlist/Segment.cpp
index b0cc2d88bd..38cb412f67 100644
--- a/modules/demux/adaptive/playlist/Segment.cpp
+++ b/modules/demux/adaptive/playlist/Segment.cpp
@@ -143,18 +143,21 @@ int ISegment::compare(ISegment *other) const
{
if(duration.Get())
{
- stime_t diff = startTime.Get() - other->startTime.Get();
- if(diff)
- return diff / diff;
+ if(startTime.Get() > other->startTime.Get())
+ return 1;
+ else if(startTime.Get() < other->startTime.Get())
+ return -1;
}
- size_t diff = startByte - other->startByte;
- if(diff)
- return diff / diff;
+ if(startByte > other->startByte)
+ return 1;
+ else if(startByte < other->startByte)
+ return -1;
- diff = endByte - other->endByte;
- if(diff)
- return diff / diff;
+ if(endByte > other->endByte)
+ return 1;
+ else if(endByte < other->endByte)
+ return -1;
return 0;
}
More information about the vlc-commits
mailing list