[vlc-commits] sout: mostly fix and clean up pace control setting
Rémi Denis-Courmont
git at videolan.org
Thu Oct 18 20:09:15 CEST 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Oct 18 20:49:16 2012 +0300| [893fb2e2527f5a0b1ff18fb3b6a24918562990fc] | committer: Rémi Denis-Courmont
sout: mostly fix and clean up pace control setting
Still transcode and ES are broken.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=893fb2e2527f5a0b1ff18fb3b6a24918562990fc
---
include/vlc_sout.h | 5 +++--
modules/stream_out/bridge.c | 11 ++---------
modules/stream_out/display.c | 7 +------
modules/stream_out/mosaic_bridge.c | 5 +----
modules/stream_out/raop.c | 6 ++----
modules/stream_out/rtp.c | 7 +------
modules/stream_out/smem.c | 7 +------
modules/stream_out/standard.c | 7 ++-----
src/stream_output/stream_output.c | 11 +++++++++--
9 files changed, 22 insertions(+), 44 deletions(-)
diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 8c98ccf..369db20 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -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 );
diff --git a/modules/stream_out/bridge.c b/modules/stream_out/bridge.c
index 2692731..262005d 100644
--- a/modules/stream_out/bridge.c
+++ b/modules/stream_out/bridge.c
@@ -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 );
}
diff --git a/modules/stream_out/display.c b/modules/stream_out/display.c
index df79244..707b5bd 100644
--- a/modules/stream_out/display.c
+++ b/modules/stream_out/display.c
@@ -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 );
diff --git a/modules/stream_out/mosaic_bridge.c b/modules/stream_out/mosaic_bridge.c
index b2e07a7..dc3fcc8 100644
--- a/modules/stream_out/mosaic_bridge.c
+++ b/modules/stream_out/mosaic_bridge.c
@@ -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 );
diff --git a/modules/stream_out/raop.c b/modules/stream_out/raop.c
index 7664615..7c21e5d 100644
--- a/modules/stream_out/raop.c
+++ b/modules/stream_out/raop.c
@@ -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--;
}
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 2104ae8..2f265fc 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -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 );
diff --git a/modules/stream_out/smem.c b/modules/stream_out/smem.c
index d26674c..e674f790 100644
--- a/modules/stream_out/smem.c
+++ b/modules/stream_out/smem.c
@@ -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 );
}
diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 30d809a..ec5c47c 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -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 );
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index fc3589a..30832df 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -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;
}
More information about the vlc-commits
mailing list