[vlc-commits] copy: Don't modify fmt_out until success is ensured
Hugo Beauzée-Luyssen
git at videolan.org
Fri Dec 8 14:01:45 CET 2017
vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Dec 8 11:41:56 2017 +0100| [1c7220608ca374abd50211ca0f355a572a711fba] | committer: Hugo Beauzée-Luyssen
copy: Don't modify fmt_out until success is ensured
(cherry picked from commit 385765703e43f9c91ff8789ce303cc0822b7c165)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1c7220608ca374abd50211ca0f355a572a711fba
---
modules/packetizer/copy.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/modules/packetizer/copy.c b/modules/packetizer/copy.c
index 7c02cfc94f..2ffa58c185 100644
--- a/modules/packetizer/copy.c
+++ b/modules/packetizer/copy.c
@@ -90,9 +90,6 @@ static int Open( vlc_object_t *p_this )
p_dec->pf_packetize = Packetize;
p_dec->pf_flush = Flush;
- /* Create the output format */
- es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
-
p_dec->p_sys = p_sys = malloc( sizeof(*p_sys) );
if (unlikely(p_sys == NULL))
return VLC_ENOMEM;
@@ -108,10 +105,11 @@ static int Open( vlc_object_t *p_this )
break;
}
+ vlc_fourcc_t fcc = p_dec->fmt_out.i_codec;
/* Fix the value of the fourcc for audio */
if( p_dec->fmt_in.i_cat == AUDIO_ES )
{
- vlc_fourcc_t fcc = vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
+ fcc = vlc_fourcc_GetCodecAudio( p_dec->fmt_in.i_codec,
p_dec->fmt_in.audio.i_bitspersample );
if( !fcc )
{
@@ -119,9 +117,12 @@ static int Open( vlc_object_t *p_this )
free( p_sys );
return VLC_EGENERIC;
}
- p_dec->fmt_out.i_codec = fcc;
}
+ /* Create the output format */
+ es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
+ p_dec->fmt_out.i_codec = fcc;
+
return VLC_SUCCESS;
}
More information about the vlc-commits
mailing list