[vlc-devel] [PATCH 3/5] sout: update pace control on ES addition/removal
RĂ©mi Denis-Courmont
remi at remlab.net
Sun Mar 1 13:11:57 CET 2020
...rather than when creating the stream output. This is necessary for
some plugins whose pace controls is determined by the set of elementary
streams.
---
src/stream_output/stream_output.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index dd83aef1c4..8bee21d226 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -166,6 +166,7 @@ bool sout_instance_ControlsPace( sout_instance_t *sout )
sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
const es_format_t *p_fmt )
{
+ sout_stream_t *stream = p_sout->p_stream;
sout_packetizer_input_t *p_input;
/* *** create a packetizer input *** */
@@ -180,7 +181,9 @@ sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
/* *** add it to the stream chain */
vlc_mutex_lock( &p_sout->lock );
- p_input->id = sout_StreamIdAdd( p_sout->p_stream, p_fmt );
+ p_sout->i_out_pace_nocontrol -= stream->pace_nocontrol;
+ p_input->id = sout_StreamIdAdd( stream, p_fmt );
+ p_sout->i_out_pace_nocontrol -= stream->pace_nocontrol;
vlc_mutex_unlock( &p_sout->lock );
if( p_input->id == NULL )
@@ -200,12 +203,15 @@ sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
int sout_InputDelete( sout_packetizer_input_t *p_input )
{
sout_instance_t *p_sout = p_input->p_sout;
+ sout_stream_t *stream = p_sout->p_stream;
msg_Dbg( p_sout, "removing a sout input (sout_input: %p)",
(void *)p_input );
vlc_mutex_lock( &p_sout->lock );
- sout_StreamIdDel( p_sout->p_stream, p_input->id );
+ p_sout->i_out_pace_nocontrol -= stream->pace_nocontrol;
+ sout_StreamIdDel( stream, p_input->id );
+ p_sout->i_out_pace_nocontrol -= stream->pace_nocontrol;
vlc_mutex_unlock( &p_sout->lock );
free( p_input );
@@ -753,12 +759,8 @@ static void mrl_Clean( mrl_t *p_mrl )
/* Destroy a "stream_out" module */
static void sout_StreamDelete( sout_stream_t *p_stream )
{
- sout_instance_t *p_sout = (sout_instance_t *)vlc_object_parent(p_stream);
-
msg_Dbg( p_stream, "destroying chain... (name=%s)", p_stream->psz_name );
- p_sout->i_out_pace_nocontrol -= p_stream->pace_nocontrol;
-
if( p_stream->p_module != NULL )
module_unneed( p_stream, p_stream->p_module );
@@ -829,7 +831,6 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
return NULL;
}
- p_sout->i_out_pace_nocontrol += p_stream->pace_nocontrol;
return p_stream;
}
--
2.20.1
More information about the vlc-devel
mailing list