]> git.sesse.net Git - vlc/commitdiff
sout: report muxer errors back
authorJean-Paul Saman <jean-paul.saman@m2x.nl>
Sat, 15 Feb 2014 14:43:38 +0000 (15:43 +0100)
committerRafaël Carré <funman@videolan.org>
Sat, 15 Feb 2014 17:36:53 +0000 (18:36 +0100)
include/vlc_sout.h
modules/stream_out/es.c
modules/stream_out/rtp.c
modules/stream_out/standard.c
modules/stream_out/transcode/transcode.c
src/input/decoder.c
src/missing.c
src/stream_output/stream_output.c

index 3bfddd1ad81d426bf2e6e0acd4381a0590a0eea6..b9366f790374562525f49d5449ec882fff348ddf 100644 (file)
@@ -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, ... )
index dba44b8e3b3e2735a93a92ce1cc489b658262776..c4b6274a29b3ffb17cf254d2013c18246e073c1b 100644 (file)
@@ -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 );
 }
 
index 80db77f3af59922c2e2c3abdc232636e89c14d64..4031d189406e3671e201af35e5ace57400cae1ec 100644 (file)
@@ -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 );
 }
 
 
index 937c33a247eca942d3ee73944cc207a66ef289dc..1bdcf6af6fbbd0f21fdec581753733225aba81a5 100644 (file)
@@ -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)
 {
index 16c9e5fc20a96760532834e09e2b7e521a9f1963..893fb4e34531a3ff813235178a828e3448bdc66a 100644 (file)
@@ -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:
index 6ec1ad1b7632aa3a3823bbc879eab0d52b52259a..46129fc9c2071ce1b847f9c825abe6f134f05429 100644 (file)
@@ -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;
         }
index a19a798e3bc0fd3580cb0ab983cb2649c41a04cd..7d913747ff50c97e0b299f42489554ea8241af28 100644 (file)
@@ -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);
 }
index 3f653f1ff902de3bd4a11fcb66608d234a5bfa53..d01fed54b2e00146ac16c090669f3633278c467e 100644 (file)
@@ -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 );
 }