hls: use av_compare_ts() instead of comparing apples to oranges.
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 20 Aug 2012 23:00:05 +0000 (01:00 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 20 Aug 2012 23:00:05 +0000 (01:00 +0200)
Fixes Ticket983

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/hls.c

index 7add01f..41ba434 100644 (file)
@@ -646,8 +646,10 @@ start:
         }
         /* Check if this stream has the packet with the lowest dts */
         if (var->pkt.data) {
+            struct variant *minvar = c->variants[minvariant];
             if (minvariant < 0 ||
-                var->pkt.dts < c->variants[minvariant]->pkt.dts)
+                av_compare_ts(var->pkt.dts, var->ctx->streams[var->pkt.stream_index]->time_base,
+                              minvar->pkt.dts, minvar->ctx->streams[minvar->pkt.stream_index]->time_base) > 0)
                 minvariant = i;
         }
     }