[vlc-commits] packetizer: mpeg4audio: update extradata on LATM change
Francois Cartegnie
git at videolan.org
Mon Feb 27 23:08:21 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 27 14:32:36 2017 +0100| [ef09a48a175828bffcac8b9c6ce67074c86ce5ea] | committer: Francois Cartegnie
packetizer: mpeg4audio: update extradata on LATM change
refs #8393
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ef09a48a175828bffcac8b9c6ce67074c86ce5ea
---
modules/packetizer/mpeg4audio.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/modules/packetizer/mpeg4audio.c b/modules/packetizer/mpeg4audio.c
index 915666bf..422a78e 100644
--- a/modules/packetizer/mpeg4audio.c
+++ b/modules/packetizer/mpeg4audio.c
@@ -809,18 +809,27 @@ static int LOASParse(decoder_t *p_dec, uint8_t *p_buffer, int i_buffer)
p_sys->i_rate = st->cfg.i_samplerate;
p_sys->i_frame_length = st->cfg.i_frame_length;
- /* FIXME And if it changes ? */
- if (p_sys->i_channels && p_sys->i_rate && p_sys->i_frame_length > 0) {
- if (!p_dec->fmt_out.i_extra && st->i_extra > 0) {
- p_dec->fmt_out.i_extra = st->i_extra;
+ if (p_sys->i_channels && p_sys->i_rate && p_sys->i_frame_length > 0)
+ {
+ if(p_dec->fmt_out.i_extra != st->i_extra ||
+ (p_dec->fmt_out.i_extra > 0 &&
+ memcmp(p_dec->fmt_out.p_extra, st->extra, st->i_extra)) )
+ {
+ if(p_dec->fmt_out.i_extra)
+ free(p_dec->fmt_out.p_extra);
p_dec->fmt_out.p_extra = malloc(st->i_extra);
- if (!p_dec->fmt_out.p_extra) {
+ if(p_dec->fmt_out.p_extra)
+ {
+ p_dec->fmt_out.i_extra = st->i_extra;
+ memcpy(p_dec->fmt_out.p_extra, st->extra, st->i_extra);
+ p_sys->b_latm_cfg = true;
+ }
+ else
+ {
p_dec->fmt_out.i_extra = 0;
- return 0;
+ p_sys->b_latm_cfg = false;
}
- memcpy(p_dec->fmt_out.p_extra, st->extra, st->i_extra);
}
- p_sys->b_latm_cfg = true;
}
}
More information about the vlc-commits
mailing list