[xiph-commits] r9900 - icecast/trunk/libshout/src

brendan at svn.xiph.org brendan at svn.xiph.org
Wed Aug 31 19:20:07 PDT 2005


Author: brendan
Date: 2005-08-31 19:20:06 -0700 (Wed, 31 Aug 2005)
New Revision: 9900

Modified:
   icecast/trunk/libshout/src/theora.c
Log:
Karl's patch. In his words: "looks like the theora part is missing the
initial setting for theora streams, on files it's generally ok the
absolute beginning is typically 0 but for streams that often isn't the
case."

Don't know exactly what that means but I trust him, and he wrote this
file anyway.


Modified: icecast/trunk/libshout/src/theora.c
===================================================================
--- icecast/trunk/libshout/src/theora.c	2005-09-01 01:55:31 UTC (rev 9899)
+++ icecast/trunk/libshout/src/theora.c	2005-09-01 02:20:06 UTC (rev 9900)
@@ -99,12 +99,16 @@
 		iframe = granulepos >> theora_data->granule_shift;
 		pframe = granulepos - (iframe << theora_data->granule_shift);
 		frames = iframe + pframe;
-		new_time = (frames  * per_frame);
+		if (theora_data->prev_time == 0)
+			theora_data->prev_time = (frames - ogg_page_packets(page))*per_frame;
+		else
+		{
+			new_time = (frames  * per_frame);
+			duration = new_time - theora_data->prev_time;
+			theora_data->prev_time = new_time;
 
-		duration = new_time - theora_data->prev_time;
-		theora_data->prev_time = new_time;
-
-		codec->senttime += (uint64_t)(duration + 0.5);
+			codec->senttime += (uint64_t)(duration + 0.5);
+		}
 	}
 
 	return SHOUTERR_SUCCESS;



More information about the commits mailing list