Commit 893fb2e2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

sout: mostly fix and clean up pace control setting

Still transcode and ES are broken.
parent 938d93aa
......@@ -40,7 +40,8 @@ extern "C" {
#include <sys/types.h>
#include <vlc_es.h>
/** Stream output instance */
/** Stream output instance (FIXME: should be private to src/ to avoid
* invalid unsycnrhonized access) */
struct sout_instance_t
{
VLC_COMMON_MEMBERS
......@@ -189,8 +190,8 @@ struct sout_stream_t
/* manage a packet */
int (*pf_send)( sout_stream_t *, sout_stream_id_t *, block_t* );
/* private */
sout_stream_sys_t *p_sys;
bool pace_nocontrol;
};
VLC_API void sout_StreamChainDelete(sout_stream_t *p_first, sout_stream_t *p_last );
......
......@@ -216,8 +216,7 @@ static int OpenOut( vlc_object_t *p_this )
p_stream->pf_send = SendOut;
p_stream->p_sys = (sout_stream_sys_t *)p_sys;
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->pace_nocontrol = true;
return VLC_SUCCESS;
}
......@@ -230,8 +229,6 @@ static void CloseOut( vlc_object_t * p_this )
sout_stream_t *p_stream = (sout_stream_t*)p_this;
out_sout_stream_sys_t *p_sys = (out_sout_stream_sys_t *)p_stream->p_sys;
p_stream->p_sout->i_out_pace_nocontrol--;
free( p_sys->psz_name );
free( p_sys );
}
......@@ -435,9 +432,7 @@ static int OpenIn( vlc_object_t *p_this )
p_stream->pf_send = SendIn;
p_stream->p_sys = (sout_stream_sys_t *)p_sys;
/* update p_sout->i_out_pace_nocontrol */
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->pace_nocontrol = true;
return VLC_SUCCESS;
}
......@@ -450,8 +445,6 @@ static void CloseIn( vlc_object_t * p_this )
sout_stream_t *p_stream = (sout_stream_t*)p_this;
in_sout_stream_sys_t *p_sys = (in_sout_stream_sys_t *)p_stream->p_sys;
p_stream->p_sout->i_out_pace_nocontrol--;
free( p_sys->psz_name );
free( p_sys );
}
......
......@@ -118,9 +118,7 @@ static int Open( vlc_object_t *p_this )
p_stream->pf_del = Del;
p_stream->pf_send = Send;
p_stream->p_sys = p_sys;
/* update p_sout->i_out_pace_nocontrol */
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->pace_nocontrol = true;
return VLC_SUCCESS;
}
......@@ -133,9 +131,6 @@ static void Close( vlc_object_t * p_this )
sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_stream_sys_t *p_sys = p_stream->p_sys;
/* update p_sout->i_out_pace_nocontrol */
p_stream->p_sout->i_out_pace_nocontrol--;
input_resource_Terminate( p_sys->p_resource );
input_resource_Release( p_sys->p_resource );
free( p_sys );
......
......@@ -249,8 +249,7 @@ static int Open( vlc_object_t *p_this )
p_stream->pf_add = Add;
p_stream->pf_del = Del;
p_stream->pf_send = Send;
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->pace_nocontrol = true;
return VLC_SUCCESS;
}
......@@ -270,8 +269,6 @@ static void Close( vlc_object_t * p_this )
var_DelCallback( p_stream, CFG_PREFIX "x", xCallback, p_stream );
var_DelCallback( p_stream, CFG_PREFIX "y", yCallback, p_stream );
p_stream->p_sout->i_out_pace_nocontrol--;
free( p_sys->psz_id );
free( p_sys );
......
......@@ -1390,11 +1390,11 @@ static int Open( vlc_object_t *p_this )
goto error;
}
p_stream->p_sys = p_sys;
p_stream->pf_add = Add;
p_stream->pf_del = Del;
p_stream->pf_send = Send;
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->p_sys = p_sys;
p_stream->pace_nocontrol = true;
p_sys->i_control_fd = -1;
p_sys->i_stream_fd = -1;
......@@ -1554,8 +1554,6 @@ static void Close( vlc_object_t *p_this )
SendTeardown( p_this );
FreeSys( p_this, p_sys );
p_stream->p_sout->i_out_pace_nocontrol--;
}
......
......@@ -601,6 +601,7 @@ static int Open( vlc_object_t *p_this )
p_stream->pf_del = Del;
p_stream->pf_send = Send;
}
p_stream->pace_nocontrol = true;
if( var_GetBool( p_stream, SOUT_CFG_PREFIX"sap" ) )
SDPHandleUrl( p_stream, "sap" );
......@@ -629,9 +630,6 @@ static int Open( vlc_object_t *p_this )
free( psz );
}
/* update p_sout->i_out_pace_nocontrol */
p_stream->p_sout->i_out_pace_nocontrol++;
if( p_sys->p_mux != NULL )
{
sout_stream_id_t *id = Add( p_stream, NULL );
......@@ -653,9 +651,6 @@ static void Close( vlc_object_t * p_this )
sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_stream_sys_t *p_sys = p_stream->p_sys;
/* update p_sout->i_out_pace_nocontrol */
p_stream->p_sout->i_out_pace_nocontrol--;
if( p_sys->p_mux )
{
assert( p_sys->i_es <= 1 );
......
......@@ -191,10 +191,7 @@ static int Open( vlc_object_t *p_this )
p_stream->pf_add = Add;
p_stream->pf_del = Del;
p_stream->pf_send = Send;
/* Does the module need out_pace_control? */
if ( p_sys->time_sync )
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->pace_nocontrol = p_sys->time_sync;
return VLC_SUCCESS;
}
......@@ -205,8 +202,6 @@ static int Open( vlc_object_t *p_this )
static void Close( vlc_object_t * p_this )
{
sout_stream_t *p_stream = (sout_stream_t*)p_this;
if ( p_stream->p_sys->time_sync )
p_stream->p_sout->i_out_pace_nocontrol--;
free( p_stream->p_sys );
}
......
......@@ -406,12 +406,11 @@ static int Open( vlc_object_t *p_this )
if( var_GetBool( p_stream, SOUT_CFG_PREFIX"sap" ) )
create_SDP( p_stream, p_access );
if( !sout_AccessOutCanControlPace( p_access ) )
p_stream->p_sout->i_out_pace_nocontrol++;
p_stream->pf_add = Add;
p_stream->pf_del = Del;
p_stream->pf_send = Send;
if( !sout_AccessOutCanControlPace( p_access ) )
p_stream->pace_nocontrol = true;
ret = VLC_SUCCESS;
......@@ -440,8 +439,6 @@ static void Close( vlc_object_t * p_this )
sout_AnnounceUnRegister( p_stream, p_sys->p_session );
sout_MuxDelete( p_sys->p_mux );
if( !sout_AccessOutCanControlPace( p_access ) )
p_stream->p_sout->i_out_pace_nocontrol--;
sout_AccessOutDelete( p_access );
free( p_sys );
......
......@@ -717,9 +717,14 @@ 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 *)(p_stream->p_parent);
msg_Dbg( p_stream, "destroying chain... (name=%s)", p_stream->psz_name );
if( p_stream->p_module ) module_unneed( p_stream, p_stream->p_module );
p_sout->i_out_pace_nocontrol -= p_stream->pace_nocontrol;
if( p_stream->p_module != NULL )
module_unneed( p_stream, p_stream->p_module );
FREENULL( p_stream->psz_name );
......@@ -765,10 +770,11 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
return NULL;
p_stream->p_sout = p_sout;
p_stream->p_sys = NULL;
p_stream->psz_name = psz_name;
p_stream->p_cfg = p_cfg;
p_stream->p_next = p_next;
p_stream->pace_nocontrol = false;
p_stream->p_sys = NULL;
msg_Dbg( p_sout, "stream=`%s'", p_stream->psz_name );
......@@ -785,6 +791,7 @@ 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;
}
......
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