[xiph-commits] r10192 - trunk/xiph-rtp

lu_zero at svn.xiph.org lu_zero at svn.xiph.org
Tue Oct 18 09:51:40 PDT 2005


Author: lu_zero
Date: 2005-10-18 09:51:38 -0700 (Tue, 18 Oct 2005)
New Revision: 10192

Modified:
   trunk/xiph-rtp/vorbisrtp-client2.c
   trunk/xiph-rtp/vorbisrtp2.c
Log:
Header fixes from MikeS and some minor changes.
The timestamp -> granulepos conversion is still pretty wrong.



Modified: trunk/xiph-rtp/vorbisrtp-client2.c
===================================================================
--- trunk/xiph-rtp/vorbisrtp-client2.c	2005-10-18 15:35:04 UTC (rev 10191)
+++ trunk/xiph-rtp/vorbisrtp-client2.c	2005-10-18 16:51:38 UTC (rev 10192)
@@ -30,7 +30,8 @@
 
 /* sample RTP Vorbis client */
 
-/* compile with: gcc -g -O2 -Wall -o vorbisrtp-client vorbisrtp-client.c -logg */
+/* compile with: gcc -g -O2 -Wall -o vorbisrtp-client vorbisrtp-client.c -logg 
+ * append -DCHECK -lvorbis to enable header checks*/
 
 
 #include <stdio.h>
@@ -194,35 +195,38 @@
    { 3,'v','o','r','b','i','s', 
    	10,0,0,0, 
    		'v','o','r','b','i','s','-','r','t','p',
-   		1,0,0,0, 
-   			1,0,0,0,
-   			0,
-   	1};
+   		0,0,0,0, 
+                1};
   
 /* get the identification packet*/
   id.packet = ogg->op.packet;
   id.bytes = 30;
-  id.b_o_s = 256;
+  id.b_o_s = 1;
+  id.e_o_s = 0;
+  id.granulepos = 0;
 
 
 /* get the comment packet*/
   co.packet = comment;
-  co.bytes = 135;
-  co.granulepos = -1;
-  co.packetno = -1;
+  co.bytes = sizeof(comment);
+  co.b_o_s = 0;
+  co.e_o_s = 0;
+  co.granulepos = 0;
 
 /* get the setup packet*/
   cb.packet = ogg->op.packet + 30;
   cb.bytes = ogg->op.bytes - 30;
+  cb.b_o_s = 0;
+  cb.e_o_s = 0;
+  cb.granulepos = 0;
 
-/* get the information required to decode blocksizes
- * from the info packet */
+/* get the sample rate from the info packet */
   ogg->vi.rate=id.packet[12];
   ogg->vi.rate+=id.packet[12+1]<<8;
   ogg->vi.rate+=id.packet[12+2]<<8;
   ogg->vi.rate+=id.packet[12+3]<<24;
+#if CHECK
   fprintf(stderr,"parsed rate: %d\n",ogg->vi.rate);
-#if CHECK
   vorbis_info_init(&ogg->vi);
   vorbis_comment_init(&ogg->vc);
   if(vorbis_synthesis_headerin(&ogg->vi,&ogg->vc,&id)<0){

Modified: trunk/xiph-rtp/vorbisrtp2.c
===================================================================
--- trunk/xiph-rtp/vorbisrtp2.c	2005-10-18 15:35:04 UTC (rev 10191)
+++ trunk/xiph-rtp/vorbisrtp2.c	2005-10-18 16:51:38 UTC (rev 10192)
@@ -294,17 +294,10 @@
     static unsigned char* framestack = NULL;
 
 /*===========================================================================*/
-/*  Test Codebook Ident (used for debug)                                     */
+/*  Set sleeptime value based on timestamp                                   */
 /*===========================================================================*/
 
-/*    vorbheader -> cbident = htonl (0xc0deb00c); */
 
-/*===========================================================================*/
-/*  Set sleeptime value (todo: this should use the granulepos)               */
-/*===========================================================================*/
-//vorbis_packet_blocksize should be used. <MikeS> Like "(blocksize(prev) + blocksize(current)) / 4"
-
-
 if (type)
     sleeptime = 300; //  ((1 / (float) bitrate) * 1000000);
 else
@@ -431,7 +424,7 @@
             else
                 progressmarker (5);
 
-            usleep (sleeptime);
+            usleep (sleeptime/2);
 
             RTPHeaders.sequence++;
             RTPHeaders.timestamp += sleeptime;



More information about the commits mailing list