[vlc-devel] interruption during network stream

Romuald DELAVERGNE romuald.delavergne at mercuria.com
Tue Feb 4 11:35:48 CET 2003


Hi,

At line 344 of src/input/input.c source file we have:

        if( i_count == 0 && p_input->stream.b_connected )
        {
            /* End of file - we do not set b_die because only the
             * playlist is allowed to do so. */
            msg_Info( p_input, "EOF reached" );
            p_input->b_eof = 1;
        }

But if there is an interruption which takes enough time to empty the buffer, vlc stops. That's why I propose to test if all datas are received to know if the stream is finished and to try to reconnect to the server in the other case.

Something like that:

--- vlc-0.4.6/src/input/input.c	2002-11-13 23:50:51.000000000 +0100
+++ vlc-0.4.6/src/input/input.c	2003-02-04 10:52:46.000000000 +0100
@@ -411,10 +411,36 @@ static int RunThread( input_thread_t *p_
 
         if( i_count == 0 && p_input->stream.b_seekable )
         {
-            /* End of file - we do not set b_die because only the
-             * interface is allowed to do so. */
-            intf_WarnMsg( 3, "input: EOF reached" );
-            p_input->b_eof = 1;
+            if (p_input->stream.p_selected_area->i_tell >= p_input->stream.p_selected_area->i_size)
+            {
+                /* End of file - we do not set b_die because only the
+                * interface is allowed to do so. */
+                intf_WarnMsg( 3, "input: EOF reached" );
+                p_input->b_eof = 1;
+            }
+            else
+            {
+                intf_WarnMsg( 1, "input: BUFFER empty" );
+                // Trying to reconnect to server
+                if( p_input->stream.b_seekable && p_input->pf_seek != NULL )
+                {
+                    intf_WarnMsg( 1, "input: trying to reconnect..." );
+                    /* Reinitialize buffer manager. */
+                    input_AccessReinit(p_input);
+                    /* seek where we stop */
+                    p_input->pf_seek(p_input, p_input->stream.p_selected_area->i_tell);
+
+                    /* Escape all decoders for the stream discontinuity they
+                     * will encounter. */
+                    input_EscapeDiscontinuity(p_input);
+
+                    for (i = 0; i < p_input->stream.i_pgrm_number; i++) {
+                        pgrm_descriptor_t * p_pgrm = p_input->stream.pp_programs[i];
+                        /* Reinitialize synchro. */
+                        p_pgrm->i_synchro_state = SYNCHRO_REINIT;
+                    }
+                }
+            }
         }
         else if( i_count < 0 )
         {
-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>



More information about the vlc-devel mailing list