Commit 1af77eb5 authored by Thomas Guillem's avatar Thomas Guillem

videotoolbox: don't try to parse Annex B if current stream is avcC

parent 254c6bb4
...@@ -97,6 +97,7 @@ struct decoder_sys_t ...@@ -97,6 +97,7 @@ struct decoder_sys_t
size_t codec_level; size_t codec_level;
bool b_started; bool b_started;
bool b_is_avcc;
VTDecompressionSessionRef session; VTDecompressionSessionRef session;
CMVideoFormatDescriptionRef videoFormatDescription; CMVideoFormatDescriptionRef videoFormatDescription;
...@@ -251,6 +252,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block) ...@@ -251,6 +252,7 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
if (p_block == NULL) { if (p_block == NULL) {
int buf_size = p_dec->fmt_in.i_extra + 20; int buf_size = p_dec->fmt_in.i_extra + 20;
uint32_t i_nal_size = 0;
size = p_dec->fmt_in.i_extra; size = p_dec->fmt_in.i_extra;
p_buf = malloc(buf_size); p_buf = malloc(buf_size);
...@@ -262,13 +264,14 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block) ...@@ -262,13 +264,14 @@ static int StartVideoToolbox(decoder_t *p_dec, block_t *p_block)
/* we need to convert the SPS and PPS units we received from the /* we need to convert the SPS and PPS units we received from the
* demuxer's avvC atom so we can process them further */ * demuxer's avvC atom so we can process them further */
i_ret = convert_sps_pps(p_dec, if (convert_sps_pps(p_dec,
p_dec->fmt_in.p_extra, p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra, p_dec->fmt_in.i_extra,
p_buf, p_buf,
buf_size, buf_size,
&size, &size,
NULL); &i_nal_size) == VLC_SUCCESS)
p_sys->b_is_avcc = i_nal_size > 0;
} else { } else {
/* we are mid-stream, let's have the h264_get helper see if it /* we are mid-stream, let's have the h264_get helper see if it
* can find a NAL unit */ * can find a NAL unit */
...@@ -605,6 +608,7 @@ static int OpenDecoder(vlc_object_t *p_this) ...@@ -605,6 +608,7 @@ static int OpenDecoder(vlc_object_t *p_this)
return VLC_ENOMEM; return VLC_ENOMEM;
p_dec->p_sys = p_sys; p_dec->p_sys = p_sys;
p_sys->b_started = false; p_sys->b_started = false;
p_sys->b_is_avcc = false;
p_sys->codec = codec; p_sys->codec = codec;
int i_ret = StartVideoToolbox(p_dec, NULL); int i_ret = StartVideoToolbox(p_dec, NULL);
...@@ -720,6 +724,9 @@ static bool H264ProcessBlock(decoder_t *p_dec, block_t *p_block) ...@@ -720,6 +724,9 @@ static bool H264ProcessBlock(decoder_t *p_dec, block_t *p_block)
if (!p_block->p_buffer) if (!p_block->p_buffer)
return false; return false;
if (p_sys->b_is_avcc)
return true;
int buf_size = p_dec->fmt_in.i_extra + 20; int buf_size = p_dec->fmt_in.i_extra + 20;
uint32_t size = p_dec->fmt_in.i_extra; uint32_t size = p_dec->fmt_in.i_extra;
uint8_t *p_sps_buf = NULL, *p_pps_buf = NULL; uint8_t *p_sps_buf = NULL, *p_pps_buf = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment