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

lu_zero at svn.xiph.org lu_zero at svn.xiph.org
Tue Apr 25 18:15:39 PDT 2006


Author: lu_zero
Date: 2006-04-25 18:15:34 -0700 (Tue, 25 Apr 2006)
New Revision: 11280

Modified:
   trunk/xiph-rtp/theorartp-client.c
   trunk/xiph-rtp/theorartp.c
   trunk/xiph-rtp/vorbisrtp.c
   trunk/xiph-rtp/xiph_rtp.c
   trunk/xiph-rtp/xiph_rtp.h
Log:
creatertp proto change: sleeptime exposed

Modified: trunk/xiph-rtp/theorartp-client.c
===================================================================
--- trunk/xiph-rtp/theorartp-client.c	2006-04-25 22:19:35 UTC (rev 11279)
+++ trunk/xiph-rtp/theorartp-client.c	2006-04-26 01:15:34 UTC (rev 11280)
@@ -67,6 +67,8 @@
 	theora_comment tc;
 	theora_state td;
 
+	long time_den;
+	long time_num;
 
 	int frag;
 	unsigned int timestamp;
@@ -188,9 +190,9 @@
 
 	oggpackB_read(&opb,64);
 	
-//	ogg->time_den =
+	ogg->time_den =
 	oggpackB_read(&opb,32);
-//	ogg->time_num = 
+	ogg->time_num = 
 	oggpackB_read(&opb,32);
 
 	oggpackB_read(&opb,24);

Modified: trunk/xiph-rtp/theorartp.c
===================================================================
--- trunk/xiph-rtp/theorartp.c	2006-04-25 22:19:35 UTC (rev 11279)
+++ trunk/xiph-rtp/theorartp.c	2006-04-26 01:15:34 UTC (rev 11280)
@@ -283,7 +283,7 @@
     memcpy (conf_packet + xr.header[0].bytes, 
 		    xr.header[2].packet,
 		    xr.header[2].bytes);
-    creatertp(&xr, conf_packet, conf_bytes, 0, 1, 0);
+    creatertp(&xr, conf_packet, conf_bytes, 0, 0, 1, 0);
     
     free(conf_packet);
 }
@@ -329,8 +329,9 @@
 			}
 			printf("  bytes %ld bos %ld eos %ld gp %lld pno %lld\n", xr.op.bytes, xr.op.b_o_s, xr.op.e_o_s, xr.op.granulepos, xr.op.packetno);
 #endif
+                        //FIXME ugly as hell and probably wrong!!!!
 			creatertp ( &xr, xr.op.packet, xr.op.bytes, 
-					timestamp, 0, xr.op.e_o_s );
+				    timestamp, timestamp, 0, xr.op.e_o_s );
             	    }
                 }
 

Modified: trunk/xiph-rtp/vorbisrtp.c
===================================================================
--- trunk/xiph-rtp/vorbisrtp.c	2006-04-25 22:19:35 UTC (rev 11279)
+++ trunk/xiph-rtp/vorbisrtp.c	2006-04-26 01:15:34 UTC (rev 11280)
@@ -255,7 +255,7 @@
     memcpy (conf_packet + xr.header[0].bytes, 
 		    xr.header[2].packet,
 		    xr.header[2].bytes);
-    creatertp(&xr, conf_packet, conf_bytes, 0, 1, 0);
+    creatertp(&xr, conf_packet, conf_bytes, 0, 0, 1, 0);
     
     free(conf_packet);
 }
@@ -287,7 +287,7 @@
 			printf("  bytes %ld bos %ld eos %ld gp %lld pno %lld\n", xr.op.bytes, xr.op.b_o_s, xr.op.e_o_s, xr.op.granulepos, xr.op.packetno);
 #endif
 			creatertp ( &xr, xr.op.packet, xr.op.bytes, 
-					timestamp, 0, xr.op.e_o_s );
+					timestamp, timestamp, 0, xr.op.e_o_s );
 			timestamp = ( vorbis_packet_blocksize(&xr.vi,&xr.op) +
 					prev ) / 4*1000000L / xr.vi.rate;
 			prev = vorbis_packet_blocksize(&xr.vi,&xr.op);

Modified: trunk/xiph-rtp/xiph_rtp.c
===================================================================
--- trunk/xiph-rtp/xiph_rtp.c	2006-04-25 22:19:35 UTC (rev 11279)
+++ trunk/xiph-rtp/xiph_rtp.c	2006-04-26 01:15:34 UTC (rev 11280)
@@ -246,22 +246,19 @@
 
 //FIXME max_payload should stay somewhere else
 void creatertp (xiph_rtp_t *xr, unsigned char* vorbdata, int length,
-		long timestamp, int type, int last)
+		long timestamp, long sleeptime, int type, int last)
 {
 	int frag, position = 0;
 	unsigned short framesize;
 	unsigned char *packet;
-	long sleeptime = timestamp;
 	framestack_t *fs = &xr->fs;
 	const unsigned int max_payload = 1000;
 
-/*  Set sleeptime value based on timestamp */
-
 	if (type)
 	{
-		sleeptime = 300; //  ((1 / (float) bitrate) * 1000000);
 		// flush any other packet in queue (chained ogg!)
-		flush_stack(xr, timestamp, timestamp);
+		flush_stack(xr, sleeptime, timestamp);
+		sleeptime = 300; //  ((1 / (float) bitrate) * 1000000);
 	}
 
 /*  Frame packing.  Used only for type 0 packets (raw Vorbis data) */
@@ -317,9 +314,8 @@
 		xr->headers.sequence = htons (xr->headers.sequence);
 		xr->headers.timestamp = ntohl (xr->headers.timestamp);
 
-	/* We need to sleep something like enough time to not overflow
-	 * the playout buffer nor starve it */
-		sleeptime = timestamp;
+        /* We need to sleep enough time to not overflow
+         * the playout buffer nor starve it */
 		usleep (sleeptime);
 
 		xr->headers.sequence++;

Modified: trunk/xiph-rtp/xiph_rtp.h
===================================================================
--- trunk/xiph-rtp/xiph_rtp.h	2006-04-25 22:19:35 UTC (rev 11279)
+++ trunk/xiph-rtp/xiph_rtp.h	2006-04-26 01:15:34 UTC (rev 11280)
@@ -113,7 +113,7 @@
 		  unsigned char TTL);
 
 void creatertp (xiph_rtp_t *xr, unsigned char* vorbdata, int length,
-		long timestamp, int type, int last);
+		long timestamp, long sleeptime, int type, int last);
 
 int sendrtp (xiph_rtp_t *xr, const void *data, int len);
 



More information about the commits mailing list