]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/asfdec.c
Merge commit '2f02bbcca050936686482453078e83dc25493da0'
[ffmpeg] / libavformat / asfdec.c
index 4db908d3d9f59c6940d83ffff8f30f83977606ed..52773ae57eb5f0cb74a134d8a811a6486c0cab3f 100644 (file)
@@ -1159,6 +1159,16 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
         asf_st = asf->asf_st;
         av_assert0(asf_st);
 
+        if (!asf_st->frag_offset && asf->packet_frag_offset) {
+            av_dlog(s, "skipping asf data pkt with fragment offset for "
+                    "stream:%d, expected:%d but got %d from pkt)\n",
+                    asf->stream_index, asf_st->frag_offset,
+                    asf->packet_frag_offset);
+            avio_skip(pb, asf->packet_frag_size);
+            asf->packet_size_left -= asf->packet_frag_size;
+            continue;
+        }
+
         if (asf->packet_replic_size == 1) {
             // frag_offset is here used as the beginning timestamp
             asf->packet_frag_timestamp = asf->packet_time_start;
@@ -1463,8 +1473,8 @@ static int asf_build_simple_index(AVFormatContext *s, int stream_index)
     int64_t current_pos = avio_tell(s->pb);
     int ret = 0;
 
-    if(avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET) < 0) {
-        return AVERROR_INVALIDDATA;
+    if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) {
+        return ret;
     }
 
     if ((ret = ff_get_guid(s->pb, &g)) < 0)