mirror of https://code.videolan.org/videolan/vlc
Merge branch 'mr270901' into 'master'
mux: ts: do not increment PID on failures See merge request videolan/vlc!2609
This commit is contained in:
commit
7fccae549b
|
@ -346,8 +346,10 @@ void MissingPATPMTFixup( demux_t *p_demux )
|
|||
es_format_Init(&esstreams[j].fmt, p_pid->probed.i_cat, p_pid->probed.i_fourcc);
|
||||
esstreams[j].fmt.i_original_fourcc = p_pid->probed.i_original_fourcc;
|
||||
|
||||
pesmux_stream_t tmppes = {0};
|
||||
tsmux_stream_t tmpts = {0};
|
||||
if( VLC_SUCCESS !=
|
||||
FillPMTESParams(mux_standard, &esstreams[j].fmt, &esstreams[j].ts, &esstreams[j].pes ) )
|
||||
FillPMTESParams(mux_standard, &esstreams[j].fmt, p_pid->i_pid, &tmpts, &tmppes ) )
|
||||
{
|
||||
es_format_Clean( &esstreams[j].fmt );
|
||||
continue;
|
||||
|
@ -356,6 +358,7 @@ void MissingPATPMTFixup( demux_t *p_demux )
|
|||
/* Important for correct remapping: Enforce probed PES stream id */
|
||||
esstreams[j].pes.i_stream_id = p_pid->probed.i_stream_id;
|
||||
|
||||
esstreams[j].ts.i_stream_type = tmpts.i_stream_type;
|
||||
esstreams[j].ts.i_pid = p_pid->i_pid;
|
||||
mapped[j].pes = &esstreams[j].pes;
|
||||
mapped[j].ts = &esstreams[j].ts;
|
||||
|
|
|
@ -752,7 +752,7 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
|
|||
}
|
||||
|
||||
int FillPMTESParams( ts_mux_standard standard, const es_format_t *fmt,
|
||||
tsmux_stream_t *ts, pesmux_stream_t *pes )
|
||||
int i_pid, tsmux_stream_t *ts, pesmux_stream_t *pes )
|
||||
{
|
||||
switch( fmt->i_codec )
|
||||
{
|
||||
|
@ -768,7 +768,7 @@ int FillPMTESParams( ts_mux_standard standard, const es_format_t *fmt,
|
|||
case VLC_CODEC_MP4V:
|
||||
ts->i_stream_type = 0x10;
|
||||
pes->i_stream_id = 0xe0;
|
||||
pes->i_es_id = ts->i_pid;
|
||||
pes->i_es_id = i_pid;
|
||||
break;
|
||||
case VLC_CODEC_HEVC:
|
||||
ts->i_stream_type = 0x24;
|
||||
|
|
|
@ -66,6 +66,6 @@ void BuildPMT( dvbpsi_t *p_dvbpsi, vlc_object_t *p_object,
|
|||
|
||||
|
||||
int FillPMTESParams( ts_mux_standard, const es_format_t *,
|
||||
tsmux_stream_t *, pesmux_stream_t * );
|
||||
int, tsmux_stream_t *, pesmux_stream_t * );
|
||||
|
||||
#endif
|
||||
|
|
|
@ -397,10 +397,9 @@ static int GetNextFreePID( sout_mux_t *p_mux, int i_pid_start )
|
|||
}
|
||||
|
||||
/* Reserve a pid and return it */
|
||||
static int AllocatePID( sout_mux_t *p_mux, int i_cat )
|
||||
static int AllocatePID( sout_mux_t *p_mux, int i_cat, bool b_save )
|
||||
{
|
||||
sout_mux_sys_t *p_sys = p_mux->p_sys;
|
||||
int i_pid;
|
||||
int *pi_candidate_pid = NULL;
|
||||
|
||||
switch( i_cat )
|
||||
|
@ -420,9 +419,8 @@ static int AllocatePID( sout_mux_t *p_mux, int i_cat )
|
|||
}
|
||||
|
||||
*pi_candidate_pid = GetNextFreePID( p_mux, *pi_candidate_pid );
|
||||
i_pid = (*pi_candidate_pid)++;
|
||||
|
||||
return i_pid;
|
||||
return (b_save) ? ++(*pi_candidate_pid) : *pi_candidate_pid + 1;
|
||||
}
|
||||
|
||||
static int pmtcompare( const void *pa, const void *pb )
|
||||
|
@ -872,13 +870,17 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
|
|||
if( !p_stream )
|
||||
goto oom;
|
||||
|
||||
if ( p_sys->b_es_id_pid )
|
||||
p_stream->ts.i_pid = p_input->fmt.i_id & 0x1fff;
|
||||
else
|
||||
p_stream->ts.i_pid = AllocatePID( p_mux, p_input->p_fmt->i_cat );
|
||||
int i_pid;
|
||||
|
||||
if ( p_sys->b_es_id_pid )
|
||||
i_pid = p_input->fmt.i_id & 0x1fff;
|
||||
else
|
||||
i_pid = AllocatePID( p_mux, p_input->p_fmt->i_cat, false );
|
||||
|
||||
tsmux_stream_t tmpts = {0};
|
||||
pesmux_stream_t tmppes = {0};
|
||||
if( FillPMTESParams( p_sys->standard, p_input->p_fmt,
|
||||
&p_stream->ts, &p_stream->pes ) != VLC_SUCCESS )
|
||||
p_stream->ts.i_pid, &tmpts, &tmppes ) != VLC_SUCCESS )
|
||||
{
|
||||
msg_Warn( p_mux, "rejecting stream with unsupported codec %4.4s",
|
||||
(char*)&p_input->p_fmt->i_codec );
|
||||
|
@ -886,6 +888,16 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
|
|||
return VLC_EGENERIC;
|
||||
}
|
||||
|
||||
p_stream->ts.i_pid = i_pid;
|
||||
|
||||
if ( !p_sys->b_es_id_pid )
|
||||
i_pid = AllocatePID( p_mux, p_input->p_fmt->i_cat, true );
|
||||
assert(i_pid == p_stream->ts.i_pid);
|
||||
|
||||
p_stream->ts.i_stream_type = tmpts.i_stream_type;
|
||||
p_stream->pes.i_stream_id = tmppes.i_stream_id;
|
||||
p_stream->pes.i_es_id = tmppes.i_es_id;
|
||||
|
||||
p_stream->pes.i_langs = 1 + p_input->p_fmt->i_extra_languages;
|
||||
p_stream->pes.lang = calloc(1, p_stream->pes.i_langs * 4);
|
||||
if( !p_stream->pes.lang )
|
||||
|
|
Loading…
Reference in New Issue