Commit fb415ec9 authored by François Cartegnie's avatar François Cartegnie 🤞

demux: ts: proper init/clean for fmt in hotfixes

parent d468e111
......@@ -303,8 +303,9 @@ void MissingPATPMTFixup( demux_t *p_demux )
{
pesmux_stream_t pes;
tsmux_stream_t ts;
es_format_t fmt;
};
es_format_t esfmt = {0};
struct esstreams_t *esstreams = calloc( i_num_pes, sizeof(struct esstreams_t) );
pes_mapped_stream_t *mapped = calloc( i_num_pes, sizeof(pes_mapped_stream_t) );
if( esstreams && mapped )
......@@ -318,10 +319,14 @@ void MissingPATPMTFixup( demux_t *p_demux )
p_pid->probed.i_fourcc == 0 )
continue;
esfmt.i_codec = p_pid->probed.i_fourcc;
es_format_Init(&esstreams[j].fmt, p_pid->probed.i_cat, p_pid->probed.i_fourcc);
if( VLC_SUCCESS !=
FillPMTESParams(mux_standard, &esfmt, &esstreams[j].ts, &esstreams[j].pes ) )
FillPMTESParams(mux_standard, &esstreams[j].fmt, &esstreams[j].ts, &esstreams[j].pes ) )
{
es_format_Clean( &esstreams[j].fmt );
continue;
}
/* Important for correct remapping: Enforce probed PES stream id */
esstreams[j].pes.i_stream_id = p_pid->probed.i_stream_id;
......@@ -329,7 +334,7 @@ void MissingPATPMTFixup( demux_t *p_demux )
esstreams[j].ts.i_pid = p_pid->i_pid;
mapped[j].pes = &esstreams[j].pes;
mapped[j].ts = &esstreams[j].ts;
mapped[j].fmt = &esfmt;
mapped[j].fmt = &esstreams[j].fmt;
j++;
}
......@@ -341,6 +346,10 @@ void MissingPATPMTFixup( demux_t *p_demux )
NULL,
1, &pmtprogramstream, &i_program_number,
j, mapped );
/* Cleanup */
for( int i=0; i<j; i++ )
es_format_Clean( &esstreams[i].fmt );
}
free(esstreams);
free(mapped);
......
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