[vlc-devel] mms problems when low bandwidth

Jakub W. Jozwicki jakub007 at go2.pl
Fri Sep 30 14:46:35 CEST 2005


Hello,   
Currently when playing mms streams there are choosen the first   
video and the first audio stream. When the bandwidth of Internet   
connection is lower than bps of mms stream there is frame decode   
error. There should be argv parameter to set preferred bps of   
audio and video, then following patch can be applied:   
   
------------CUT HERE---------------------   
diff -U 3 -dHrN -- vlc-trunk/include/network.h  
videolan/vlc-trunk/include/network.h  
--- vlc-trunk/include/network.h	2005-09-30 13:55:56.084795536  
+0200  
+++ videolan/vlc-trunk/include/network.h	2005-09-29  
23:19:06.043257048 +0200  
@@ -198,7 +198,11 @@  
                 url->psz_option = p;  
             }  
         }  
-    }  
+	if (strstr(url->psz_path,".wsx"))  
+	{  
+	    //FIXME: handle WM playlist to get correct URL 
+	}  
+    }      
 }  
   
 /*****************************************************************************  
diff -U 3 -dHrN -- vlc-trunk/include/vlc_access.h  
videolan/vlc-trunk/include/vlc_access.h  
--- vlc-trunk/include/vlc_access.h	2005-09-30  
13:55:56.134787936 +0200  
+++ videolan/vlc-trunk/include/vlc_access.h	2005-09-30  
01:20:06.367519992 +0200  
@@ -59,6 +59,12 @@  
     ACCESS_GET_PRIVATE_ID_STATE     /* arg1=int i_private_data  
arg2=vlc_bool_t *  res=can fail */  
 };  
   
+#define BTR_VIDEO_MIN 44 //56kbps modem  
+#define BTR_AUDIO_MIN 10  
+#define BTR_PREF_INIT_AUDIO(bp) if(bp.btr_pref_audio==0)  
bp.btr_pref_audio=BTR_AUDIO_MIN  
+#define BTR_PREF_INIT_VIDEO(bp) if(bp.btr_pref_video==0)  
bp.btr_pref_video=BTR_VIDEO_MIN  
+#define BTR_PREF_INIT(bp) BTR_PREF_INIT_AUDIO(bp);  
BTR_PREF_INIT_VIDEO(bp)  
+  
 struct access_t  
 {  
     VLC_COMMON_MEMBERS  
@@ -104,7 +110,13 @@  
         int          i_title;    /* idem, start from 0 (could be  
menu) */  
         int          i_seekpoint;/* idem, start from 0 */  
     } info;  
+      
     access_sys_t *p_sys;  
+    struct  
+    {  
+	int btr_pref_audio;  
+	int btr_pref_video;	  
+    } btr_pref;      
 };  
   
 #define access2_New( a, b, c, d, e ) __access2_New(VLC_OBJECT(a),  
b, c, d, e )  
diff -U 3 -dHrN -- vlc-trunk/modules/access/mms/mmsh.c  
videolan/vlc-trunk/modules/access/mms/mmsh.c  
--- vlc-trunk/modules/access/mms/mmsh.c	2005-09-30  
13:42:00.844771320 +0200  
+++ videolan/vlc-trunk/modules/access/mms/mmsh.c	2005-09-30  
01:11:32.183687816 +0200  
@@ -82,10 +82,11 @@  
     p_access->info.i_seekpoint = 0;  
     p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );  
     memset( p_sys, 0, sizeof( access_sys_t ) );  
+    BTR_PREF_INIT(p_access->btr_pref);  
     p_sys->i_proto= MMS_PROTO_HTTP;  
     p_sys->fd     = -1;  
     p_sys->i_start= 0;  
-  
+      
     /* open a tcp connection */  
     vlc_UrlParse( &p_sys->url, p_access->psz_path, 0 );  
     if( p_sys->url.psz_host == NULL || *p_sys->url.psz_host ==  
'\0' )  
diff -U 3 -dHrN -- vlc-trunk/modules/access/mms/mmstu.c  
videolan/vlc-trunk/modules/access/mms/mmstu.c  
--- vlc-trunk/modules/access/mms/mmstu.c	2005-09-30  
13:42:00.849770560 +0200  
+++ videolan/vlc-trunk/modules/access/mms/mmstu.c	2005-09-30  
03:14:44.816836752 +0200  
@@ -124,7 +124,7 @@  
     p_access->info.i_title = 0;  
     p_access->info.i_seekpoint = 0;  
     p_access->p_sys = p_sys = malloc( sizeof( access_sys_t ) );  
-    memset( p_sys, 0, sizeof( access_sys_t ) );  
+    memset( p_sys, 0, sizeof( access_sys_t ) );  
+    BTR_PREF_INIT(p_access->btr_pref);  
   
     /* *** Parse URL and get server addr/port and path *** */  
     vlc_UrlParse( &p_sys->url, p_access->psz_path, 0 );  
@@ -454,6 +454,11 @@  
     int          i;  
     int          i_streams;  
     int          i_first;  
+    int          btr_diff_best_audio;  
+    int          btr_diff_best_video;  
+    int          btr_diff;  
+    int          i_prev_audio;  
+    int          i_prev_video;  
   
   
     /* *** Open a TCP connection with server *** */  
@@ -759,7 +764,49 @@  
     i_streams = 0;  
     i_first = -1;  
     var_buffer_reinitwrite( &buffer, 0 );  
-    /* for now, select first audio and video stream */  
+      
+    btr_diff_best_audio = 32767;  
+    btr_diff_best_video = 32767;  
+    btr_diff = 0;  
+    i_prev_audio = -1;  
+    i_prev_video = -1;  
+    /* select stream with the best match to preferred bitrates */  
+      
+#define _ABS(a) (a)>0?(a):(-(a))  
+  
+    for( i = 1; i < 128; i++ )  
+    {  
+  
+        if( p_sys->asfh.stream[i].i_cat == ASF_STREAM_AUDIO )  
+        {  
+            btr_diff = _ABS ((p_sys->asfh.stream[i].i_bitrate /  
1024) - p_access->btr_pref.btr_pref_audio);  
+	    if (btr_diff < btr_diff_best_audio)  
+	    {  
+		btr_diff_best_audio = btr_diff;  
+		p_sys->asfh.stream[i].i_selected = 1;  
+		if (i_prev_audio!=-1)  
+		    p_sys->asfh.stream[i_prev_audio].i_selected =  
0;  
+		i_prev_audio = i;  
+	    }  
+	    else  
+		p_sys->asfh.stream[i].i_selected = 0;  
+	}  
+	else if( p_sys->asfh.stream[i].i_cat == ASF_STREAM_VIDEO )  
+        {  
+            btr_diff = _ABS ((p_sys->asfh.stream[i].i_bitrate /  
1024) - p_access->btr_pref.btr_pref_video);  
+	    if (btr_diff < btr_diff_best_video)  
+	    {  
+		btr_diff_best_video = btr_diff;  
+		p_sys->asfh.stream[i].i_selected = 1;  
+		if (i_prev_video!=-1)  
+		    p_sys->asfh.stream[i_prev_video].i_selected =  
0;  
+		i_prev_video = i;  
+	    }  
+	    else  
+		p_sys->asfh.stream[i].i_selected = 0;  
+	}  
+    }  
+  
     for( i = 1; i < 128; i++ )  
     {  
   
@@ -1521,7 +1568,7 @@  
                     msg_Err( p_access,  
                              "reinitialization needed -->  
unsupported" );  
                     p_access->info.b_eof = VLC_TRUE;  
-                    return -1;  
+		     return -2;		      
                 default:  
                     break;  
             }  
-------------------------------------------------  
  
How is related Demux reset to stream_Demux_New?  
I would like to fix "reinitialization needed --> unsupported"  
problem to be able to play 
mms://stream.onet.pl/media.wsx?/info/200509/8e252eb4aa.wmv&MSWMExt=.asf 
I use vlc with libvc1 integrated. 
 
Regards, 
Jimm, hackett.linux.pl 
 

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html



More information about the vlc-devel mailing list