[FFmpeg-devel] [PATCH 1/2] h2645_parse: Propagate NAL header parsing errors
James Almer
jamrial at gmail.com
Mon Mar 18 17:50:08 EET 2019
On 3/18/2019 12:46 PM, Derek Buitenhuis wrote:
> If we don't propagate these errors, h264dec and hevcdec can get up to all sorts of
> weirdness, especially threaded, while trying to continue on with things they shouldn't.
> Can cause stuff like:
>
> [hevc @ 0x5555577107c0] get_buffer() cannot be called after ff_thread_finish_setup()
> [hevc @ 0x5555577107c0] thread_get_buffer() failed
> [hevc @ 0x5555577107c0] Error parsing NAL unit #5.
> Error while decoding stream #0:0: Cannot allocate memory
> <deadlock>
>
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>
> ---
> libavcodec/h2645_parse.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
> index 942f2c5d71..175c986c71 100644
> --- a/libavcodec/h2645_parse.c
> +++ b/libavcodec/h2645_parse.c
> @@ -503,6 +503,8 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
> nal->type);
> }
> pkt->nb_nals--;
> + if (ret < 0)
> + return ret;
This will abort the splitting process when it's meant to only discard
the faulty NAL. Even the log message stats it's skipping it.
More information about the ffmpeg-devel
mailing list