Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / libavformat / aptxdec.c
index 693316e..0637a8a 100644 (file)
@@ -58,7 +58,6 @@ static int aptx_read_header(AVFormatContext *s)
     st->codecpar->codec_id = AV_CODEC_ID_APTX;
     st->codecpar->bits_per_coded_sample = 4;
     st->codecpar->block_align = APTX_BLOCK_SIZE;
-    st->codecpar->frame_size = APTX_PACKET_SIZE;
     return 0;
 }
 
@@ -70,18 +69,23 @@ static int aptx_hd_read_header(AVFormatContext *s)
     st->codecpar->codec_id = AV_CODEC_ID_APTX_HD;
     st->codecpar->bits_per_coded_sample = 6;
     st->codecpar->block_align = APTX_HD_BLOCK_SIZE;
-    st->codecpar->frame_size = APTX_HD_PACKET_SIZE;
     return 0;
 }
 
 static int aptx_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    return av_get_packet(s->pb, pkt, APTX_PACKET_SIZE);
+    int ret = av_get_packet(s->pb, pkt, APTX_PACKET_SIZE);
+    if (ret >= 0 && !(ret % APTX_BLOCK_SIZE))
+        pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+    return ret >= 0 ? 0 : ret;
 }
 
 static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    return av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE);
+    int ret = av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE);
+    if (ret >= 0 && !(ret % APTX_HD_BLOCK_SIZE))
+        pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
+    return ret >= 0 ? 0 : ret;
 }
 
 static const AVOption aptx_options[] = {