Just because we try to put multiple units of block_align bytes (the atomic units for APTX and APTX HD) into one packet does not mean that packets with fewer units than the one we wanted are corrupt; only those packets that are not a multiple of block_align are.
Showing the changes to libavformat (1 of 1 file). Show all
Unified · Split
| @@ -74,12 +74,18 @@ static int aptx_hd_read_header(AVFormatContext *s) · 73 unmodified lines | |||
| 74 | 74 | ||
| 75 | static int aptx_read_packet(AVFormatContext *s, AVPacket *pkt) | 75 | static int aptx_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 76 | { | 76 | { |
| 77 | return av_get_packet(s->pb, pkt, APTX_PACKET_SIZE); | 77 | int ret = av_get_packet(s->pb, pkt, APTX_PACKET_SIZE); |
| 78 | if (ret >= 0 && !(ret % APTX_BLOCK_SIZE)) | ||
| 79 | pkt->flags &= ~AV_PKT_FLAG_CORRUPT; | ||
| 80 | return ret >= 0 ? 0 : ret; | ||
| 78 | } | 81 | } |
| 79 | 82 | ||
| 80 | static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt) | 83 | static int aptx_hd_read_packet(AVFormatContext *s, AVPacket *pkt) |
| 81 | { | 84 | { |
| 82 | return av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE); | 85 | int ret = av_get_packet(s->pb, pkt, APTX_HD_PACKET_SIZE); |
| 86 | if (ret >= 0 && !(ret % APTX_HD_BLOCK_SIZE)) | ||
| 87 | pkt->flags &= ~AV_PKT_FLAG_CORRUPT; | ||
| 88 | return ret >= 0 ? 0 : ret; | ||
| 83 | } | 89 | } |
| 84 | 90 | ||
| 85 | static const AVOption aptx_options[] = { | 91 | static const AVOption aptx_options[] = { |