[vlc-commits] sout: add SOUT_STREAM_IS_SYNCHRONOUS control

Rémi Denis-Courmont git at videolan.org
Sun Oct 11 14:18:41 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 10 14:05:14 2020 +0300| [36dd627f61987751d9c191c42995cbdf9b14b515] | committer: Rémi Denis-Courmont

sout: add SOUT_STREAM_IS_SYNCHRONOUS control

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=36dd627f61987751d9c191c42995cbdf9b14b515
---

 include/vlc_sout.h                | 11 +++++++++++
 src/stream_output/stream_output.c |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 8d7c07aebb..7ccd635ada 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -186,6 +186,7 @@ enum sout_stream_query_e {
     SOUT_STREAM_EMPTY,    /* arg1=bool *,       res=can fail (assume true) */
     SOUT_STREAM_WANTS_SUBSTREAMS,  /* arg1=bool *, res=can fail (assume false) */
     SOUT_STREAM_ID_SPU_HIGHLIGHT,  /* arg1=void *, arg2=const vlc_spu_highlight_t *, res=can fail */
+    SOUT_STREAM_IS_SYNCHRONOUS, /* arg1=bool *, can fail (assume false) */
 };
 
 struct sout_stream_operations {
@@ -286,6 +287,16 @@ static inline int sout_StreamControl( sout_stream_t *s, int i_query, ... )
     return i_result;
 }
 
+static inline bool sout_StreamIsSynchronous(sout_stream_t *s)
+{
+    bool b;
+
+    if (sout_StreamControl(s, SOUT_STREAM_IS_SYNCHRONOUS, &b))
+        b = false;
+
+    return b;
+}
+
 /****************************************************************************
  * Encoder
  ****************************************************************************/
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 524b1a65ca..2d6c6764ba 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -152,10 +152,11 @@ void sout_DeleteInstance( sout_instance_t * p_sout )
 
 bool sout_instance_ControlsPace( sout_instance_t *sout )
 {
-    bool ret;
+    bool ret = false;
 
     vlc_mutex_lock( &sout->lock );
-    ret = sout->i_out_pace_nocontrol <= 0;
+    if (!sout_StreamIsSynchronous(sout->p_stream))
+        ret = sout->i_out_pace_nocontrol <= 0;
     vlc_mutex_unlock( &sout->lock );
     return ret;
 }



More information about the vlc-commits mailing list