diff mbox series

[FFmpeg-devel] avformat/demux: preserve AV_PKT_FLAG_CORRUPT in parse_packet

Message ID 20211021162131.1437150-1-alexthreed@gmail.com
State Accepted
Commit 3925b826df365a2365118600bd7910cbca95286d
Headers show
Series [FFmpeg-devel] avformat/demux: preserve AV_PKT_FLAG_CORRUPT in parse_packet
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 fail Make fate failed
andriy/make_ppc success Make finished
andriy/make_fate_ppc fail Make fate failed

Commit Message

Alex Shumsky Oct. 21, 2021, 4:21 p.m. UTC
If original packet is corrupted, then parsed packet is probably corrupted too.
Let the application decide what to do.

Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
---
 libavformat/demux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer Oct. 25, 2021, 11:31 p.m. UTC | #1
On 10/21/2021 1:21 PM, Alex Shumsky wrote:
> If original packet is corrupted, then parsed packet is probably corrupted too.
> Let the application decide what to do.
> 
> Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
> ---
>   libavformat/demux.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/demux.c b/libavformat/demux.c
> index 6a4b687bf1..71a1a9bf03 100644
> --- a/libavformat/demux.c
> +++ b/libavformat/demux.c
> @@ -1179,7 +1179,7 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt,
>           out_pkt->pts          = sti->parser->pts;
>           out_pkt->dts          = sti->parser->dts;
>           out_pkt->pos          = sti->parser->pos;
> -        out_pkt->flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
> +        out_pkt->flags       |= pkt->flags & (AV_PKT_FLAG_DISCARD | AV_PKT_FLAG_CORRUPT);
>   
>           if (sti->need_parsing == AVSTREAM_PARSE_FULL_RAW)
>               out_pkt->pos = sti->parser->frame_offset;

Will apply.
diff mbox series

Patch

diff --git a/libavformat/demux.c b/libavformat/demux.c
index 6a4b687bf1..71a1a9bf03 100644
--- a/libavformat/demux.c
+++ b/libavformat/demux.c
@@ -1179,7 +1179,7 @@  static int parse_packet(AVFormatContext *s, AVPacket *pkt,
         out_pkt->pts          = sti->parser->pts;
         out_pkt->dts          = sti->parser->dts;
         out_pkt->pos          = sti->parser->pos;
-        out_pkt->flags       |= pkt->flags & AV_PKT_FLAG_DISCARD;
+        out_pkt->flags       |= pkt->flags & (AV_PKT_FLAG_DISCARD | AV_PKT_FLAG_CORRUPT);
 
         if (sti->need_parsing == AVSTREAM_PARSE_FULL_RAW)
             out_pkt->pos = sti->parser->frame_offset;