[vlc-devel] [PATCH 2/3] demux: adaptive: fix segment compare
Zhao Zhili
quinkblack at foxmail.com
Sat Dec 16 16:12:41 CET 2017
---
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 b0cc2d8..38cb412 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;
}
--
2.7.4
More information about the vlc-devel
mailing list