[vlc-commits] codec: hxxx: also parse avcC for SPS/PPS change
Thomas Guillem
git at videolan.org
Thu Apr 20 15:10:12 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr 20 11:30:01 2017 +0200| [6c4fb6618432051b126d9b6b60b2cef4046280d0] | committer: Thomas Guillem
codec: hxxx: also parse avcC for SPS/PPS change
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c4fb6618432051b126d9b6b60b2cef4046280d0
---
modules/codec/hxxx_helper.c | 25 +++++++++++++++++++++----
modules/codec/videotoolbox.m | 2 +-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index fe241d2c6c..f2b69c52eb 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -375,11 +375,9 @@ helper_process_block_xvcc2annexb(struct hxxx_helper *hh, block_t *p_block,
bool *p_config_changed)
{
assert(helper_nal_length_valid(hh));
- if (p_config_changed != NULL)
- *p_config_changed = false;
h264_AVC_to_AnnexB(p_block->p_buffer, p_block->i_buffer,
hh->i_nal_length_size);
- return p_block;
+ return helper_process_block_h264_annexb(hh, p_block, p_config_changed);
}
static block_t *
@@ -391,6 +389,25 @@ helper_process_block_h264_annexb2avcc(struct hxxx_helper *hh, block_t *p_block,
}
static block_t *
+helper_process_block_h264_avcc(struct hxxx_helper *hh, block_t *p_block,
+ bool *p_config_changed)
+{
+ if (p_config_changed != NULL)
+ {
+ int i_ret = h264_helper_parse_nal(hh, p_block->p_buffer,
+ p_block->i_buffer,
+ hh->i_nal_length_size,
+ p_config_changed);
+ if (i_ret != VLC_SUCCESS)
+ {
+ block_Release(p_block);
+ return NULL;
+ }
+ }
+ return p_block;
+}
+
+static block_t *
helper_process_block_dummy(struct hxxx_helper *hh, block_t *p_block,
bool *p_config_changed)
{
@@ -424,7 +441,7 @@ hxxx_helper_set_extra(struct hxxx_helper *hh, const void *p_extra,
if (hh->b_is_xvcC)
{
if (hh->b_need_xvcC)
- hh->pf_process_block = helper_process_block_dummy;
+ hh->pf_process_block = helper_process_block_h264_avcc;
else
hh->pf_process_block = helper_process_block_xvcc2annexb;
}
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index 4cffee2d89..dd5b8c8609 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -1296,7 +1296,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
{
/* decoding didn't start yet, which is ok for H264, let's see
* if we can use this block to get going */
- assert(p_sys->codec == kCMVideoCodecType_H264 && !p_sys->hh.b_is_xvcC);
+ assert(p_sys->codec == kCMVideoCodecType_H264);
if (p_sys->session)
{
msg_Dbg(p_dec, "SPS/PPS changed: draining H264 decoder");
More information about the vlc-commits
mailing list