rmdec: flush audio packet on seeking
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 17 Mar 2013 23:00:02 +0000 (00:00 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 17 Mar 2013 23:08:59 +0000 (00:08 +0100)
Fixes Ticket1605

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

index d5e4094..478b35b 100644 (file)
@@ -1004,6 +1004,18 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
     return dts;
 }
 
+static int rm_read_seek(AVFormatContext *s, int stream_index,
+                        int64_t pts, int flags)
+{
+    RMDemuxContext *rm = s->priv_data;
+
+    if (ff_seek_frame_binary(s, stream_index, pts, flags) < 0)
+        return -1;
+    rm->audio_pkt_cnt = 0;
+    return 0;
+}
+
+
 AVInputFormat ff_rm_demuxer = {
     .name           = "rm",
     .long_name      = NULL_IF_CONFIG_SMALL("RealMedia"),
@@ -1013,6 +1025,7 @@ AVInputFormat ff_rm_demuxer = {
     .read_packet    = rm_read_packet,
     .read_close     = rm_read_close,
     .read_timestamp = rm_read_dts,
+    .read_seek      = rm_read_seek,
 };
 
 AVInputFormat ff_rdt_demuxer = {