]> git.sesse.net Git - vlc/blobdiff - modules/demux/live555.cpp
* a few more
[vlc] / modules / demux / live555.cpp
index c04c67670b8578ed166201395e24c6a7df8c3705..7e62c2c056d01e1c8742a535b1f89de5eb200ae5 100644 (file)
@@ -28,8 +28,6 @@
  *****************************************************************************/
 
 #include <vlc/vlc.h>
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
 
 #include <vlc_demux.h>
 #include <vlc_interface.h>
@@ -41,6 +39,7 @@
 #   include <winsock2.h>
 #endif
 
+#include "UsageEnvironment.hh"
 #include "BasicUsageEnvironment.hh"
 #include "GroupsockHelper.hh"
 #include "liveMedia.hh"
@@ -441,7 +440,8 @@ createnew:
     if( var_CreateGetBool( p_demux, "rtsp-http" ) )
         i_http_port = var_CreateGetInteger( p_demux, "rtsp-http-port" );
 
-    if( ( p_sys->rtsp = RTSPClient::createNew(*p_sys->env, 1 /*verbose*/,
+    if( ( p_sys->rtsp = RTSPClient::createNew(*p_sys->env,
+          p_demux->p_libvlc->i_verbose > 1,
           "VLC media player", i_http_port ) ) == NULL )
     {
         msg_Err( p_demux, "RTSPClient::createNew failed (%s)",
@@ -675,7 +675,7 @@ static int SessionsSetup( demux_t *p_demux )
                 }
                 else if( !strncmp( sub->codecName(), "G726", 4 ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 'g', '7', '2', '6' ); 
+                    tk->fmt.i_codec = VLC_FOURCC( 'g', '7', '2', '6' );
                     tk->fmt.audio.i_rate = 8000;
                     tk->fmt.audio.i_channels = 1;
                     if( !strcmp( sub->codecName()+5, "40" ) )
@@ -744,7 +744,14 @@ static int SessionsSetup( demux_t *p_demux )
                 }
                 else if( !strcmp( sub->codecName(), "SPEEX" ) )
                 {
-                    tk->fmt.i_codec = VLC_FOURCC( 's', 'p', 'x', ' ' );
+                    tk->fmt.i_codec = VLC_FOURCC( 's', 'p', 'x', 'r' );
+                   if ( sub->rtpTimestampFrequency() )
+                       tk->fmt.audio.i_rate = sub->rtpTimestampFrequency();
+                    else
+                   {
+                       msg_Warn( p_demux,"Using 8kHz as default sample rate." );
+                       tk->fmt.audio.i_rate = 8000;
+                   }
                 }
             }
             else if( !strcmp( sub->mediumName(), "video" ) )
@@ -899,7 +906,9 @@ static int Play( demux_t *p_demux )
 
         /* Retrieve the timeout value and set up a timeout prevention thread */
         p_sys->i_timeout = p_sys->rtsp->sessionTimeoutParameter();
-        if( p_sys->i_timeout > 0 && !p_sys->p_timeout )
+        if( p_sys->i_timeout <= 0 )
+            p_sys->i_timeout = 60; /* default value from RFC2326 */
+        if( !p_sys->p_timeout )
         {
             msg_Dbg( p_demux, "We have a timeout of %d seconds",  p_sys->i_timeout );
             p_sys->p_timeout = (timeout_thread_t *)vlc_object_create( p_demux, sizeof(timeout_thread_t) );
@@ -1032,12 +1041,10 @@ static int Demux( demux_t *p_demux )
 
             es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
             tk->b_rtcp_sync = VLC_TRUE;
-#if 0
             /* reset PCR */
             tk->i_pts = 0;
             p_sys->i_pcr = 0;
             i_pcr = 0;
-#endif
         }
     }
 
@@ -1557,7 +1564,7 @@ static void TaskInterrupt( void *p_private )
 }
 
 /*****************************************************************************
- *  
+ *
  *****************************************************************************/
 static void TimeoutPrevention( timeout_thread_t *p_timeout )
 {