[vlc-commits] sout: report muxer errors back

Jean-Paul Saman git at videolan.org
Sat Feb 15 18:36:58 CET 2014


vlc | branch: master | Jean-Paul Saman <jean-paul.saman at m2x.nl> | Sat Feb 15 15:43:38 2014 +0100| [0f44a068cabcd7cb204646b8762262a6d5ba2962] | committer: Rafaël Carré

sout: report muxer errors back

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

 include/vlc_sout.h                       |    2 +-
 modules/stream_out/es.c                  |    4 +---
 modules/stream_out/rtp.c                 |    3 +--
 modules/stream_out/standard.c            |    3 +--
 modules/stream_out/transcode/transcode.c |    6 +++++-
 src/input/decoder.c                      |   21 ++++++++++++++++++---
 src/missing.c                            |    2 +-
 src/stream_output/stream_output.c        |    6 +++---
 8 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 3bfddd1..b9366f7 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -157,7 +157,7 @@ VLC_API sout_mux_t * sout_MuxNew( sout_instance_t*, const char *, sout_access_ou
 VLC_API sout_input_t * sout_MuxAddStream( sout_mux_t *, es_format_t * ) VLC_USED;
 VLC_API void sout_MuxDeleteStream( sout_mux_t *, sout_input_t * );
 VLC_API void sout_MuxDelete( sout_mux_t * );
-VLC_API void sout_MuxSendBuffer( sout_mux_t *, sout_input_t  *, block_t * );
+VLC_API int sout_MuxSendBuffer( sout_mux_t *, sout_input_t  *, block_t * );
 VLC_API int sout_MuxGetStream(sout_mux_t *, int , mtime_t *);
 
 static inline int sout_MuxControl( sout_mux_t *p_mux, int i_query, ... )
diff --git a/modules/stream_out/es.c b/modules/stream_out/es.c
index dba44b8..c4b6274 100644
--- a/modules/stream_out/es.c
+++ b/modules/stream_out/es.c
@@ -427,8 +427,6 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                  block_t *p_buffer )
 {
     VLC_UNUSED(p_stream);
-    sout_MuxSendBuffer( id->p_mux, id->p_input, p_buffer );
-
-    return VLC_SUCCESS;
+    return sout_MuxSendBuffer( id->p_mux, id->p_input, p_buffer );
 }
 
diff --git a/modules/stream_out/rtp.c b/modules/stream_out/rtp.c
index 80db77f..4031d18 100644
--- a/modules/stream_out/rtp.c
+++ b/modules/stream_out/rtp.c
@@ -1697,8 +1697,7 @@ static int MuxSend( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
     sout_mux_t *p_mux = p_stream->p_sys->p_mux;
     assert( p_mux != NULL );
 
-    sout_MuxSendBuffer( p_mux, (sout_input_t *)id, p_buffer );
-    return VLC_SUCCESS;
+    return sout_MuxSendBuffer( p_mux, (sout_input_t *)id, p_buffer );
 }
 
 
diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 937c33a..1bdcf6a 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -146,8 +146,7 @@ static int Del( sout_stream_t *p_stream, sout_stream_id_sys_t *id )
 static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
                  block_t *p_buffer )
 {
-    sout_MuxSendBuffer( p_stream->p_sys->p_mux, (sout_input_t*)id, p_buffer );
-    return VLC_SUCCESS;
+    return sout_MuxSendBuffer( p_stream->p_sys->p_mux, (sout_input_t*)id, p_buffer );
 }
 static void create_SDP(sout_stream_t *p_stream, sout_access_out_t *p_access)
 {
diff --git a/modules/stream_out/transcode/transcode.c b/modules/stream_out/transcode/transcode.c
index 16c9e5f..893fb4e 100644
--- a/modules/stream_out/transcode/transcode.c
+++ b/modules/stream_out/transcode/transcode.c
@@ -657,7 +657,11 @@ static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
     switch( id->p_decoder->fmt_in.i_cat )
     {
     case AUDIO_ES:
-        transcode_audio_process( p_stream, id, p_buffer, &p_out );
+        if( transcode_audio_process( p_stream, id, p_buffer, &p_out )
+            != VLC_SUCCESS )
+        {
+            return VLC_EGENERIC;
+        }
         break;
 
     case VIDEO_ES:
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 6ec1ad1..46129fc 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1467,7 +1467,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic )
 }
 
 #ifdef ENABLE_SOUT
-static void DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block )
+static int DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
 
@@ -1490,9 +1490,15 @@ static void DecoderPlaySout( decoder_t *p_dec, block_t *p_sout_block )
     vlc_mutex_unlock( &p_owner->lock );
 
     if( !b_reject )
-        sout_InputSendBuffer( p_owner->p_sout_input, p_sout_block ); // FIXME --VLC_TS_INVALID inspect stream_output/*
+    {
+        /* FIXME --VLC_TS_INVALID inspect stream_output*/
+        return sout_InputSendBuffer( p_owner->p_sout_input, p_sout_block );
+    }
     else
+    {
         block_Release( p_sout_block );
+        return VLC_EGENERIC;
+    }
 }
 #endif
 
@@ -1541,7 +1547,16 @@ static void DecoderProcessSout( decoder_t *p_dec, block_t *p_block )
 
             p_sout_block->p_next = NULL;
 
-            DecoderPlaySout( p_dec, p_sout_block );
+            if( DecoderPlaySout( p_dec, p_sout_block ) == VLC_EGENERIC )
+            {
+                msg_Err( p_dec, "cannot continue streaming due to errors" );
+
+                p_dec->b_error = true;
+
+                /* Cleanup */
+                block_ChainRelease( p_next );
+                return;
+            }
 
             p_sout_block = p_next;
         }
diff --git a/src/missing.c b/src/missing.c
index a19a798..7d91374 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -287,7 +287,7 @@ sout_mux_t *sout_MuxNew (sout_instance_t *instance, const char *mux,
     assert (0);
 }
 
-void sout_MuxSendBuffer (sout_mux_t *mux, sout_input_t *input, block_t *block)
+int sout_MuxSendBuffer (sout_mux_t *mux, sout_input_t *input, block_t *block)
 {
     assert (0);
 }
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 3f653f1..d01fed5 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -512,7 +512,7 @@ void sout_MuxDeleteStream( sout_mux_t *p_mux, sout_input_t *p_input )
 /*****************************************************************************
  * sout_MuxSendBuffer:
  *****************************************************************************/
-void sout_MuxSendBuffer( sout_mux_t *p_mux, sout_input_t *p_input,
+int sout_MuxSendBuffer( sout_mux_t *p_mux, sout_input_t *p_input,
                          block_t *p_buffer )
 {
     block_FifoPut( p_input->p_fifo, p_buffer );
@@ -535,10 +535,10 @@ void sout_MuxSendBuffer( sout_mux_t *p_mux, sout_input_t *p_input,
         /* Wait until we have enought data before muxing */
         if( p_mux->i_add_stream_start < 0 ||
             p_buffer->i_dts < p_mux->i_add_stream_start + i_caching )
-            return;
+            return VLC_SUCCESS;
         p_mux->b_waiting_stream = false;
     }
-    p_mux->pf_mux( p_mux );
+    return p_mux->pf_mux( p_mux );
 }
 
 



More information about the vlc-commits mailing list