[xiph-commits] r10787 - trunk/xiph-rtp
lu_zero at svn.xiph.org
lu_zero at svn.xiph.org
Wed Feb 8 14:40:24 PST 2006
Author: lu_zero
Date: 2006-02-08 14:40:22 -0800 (Wed, 08 Feb 2006)
New Revision: 10787
Modified:
trunk/xiph-rtp/xiph_rtp.c
Log:
Fix for a side case, thank you to Stefan Ehmann <shoesoft at gmx.net> for finding and providing a patch
Modified: trunk/xiph-rtp/xiph_rtp.c
===================================================================
--- trunk/xiph-rtp/xiph_rtp.c 2006-02-08 18:01:16 UTC (rev 10786)
+++ trunk/xiph-rtp/xiph_rtp.c 2006-02-08 22:40:22 UTC (rev 10787)
@@ -242,24 +242,24 @@
/* Frame packing. Used only for type 0 packets (raw Vorbis data) */
- if ((length < max_payload && type == 0 ) || fs->stacksize ) {
+ if ((length <= max_payload && type == 0 ) || fs->stacksize ) {
- if (length + fs->stacksize < max_payload
+ if (length + fs->stacksize <= max_payload
&& fs->stackcount < 15)
{
- fs->framestack = realloc (fs->framestack, (fs->stacksize + (length + 2)));
+ fs->framestack = realloc (fs->framestack,
+ (fs->stacksize + (length + 2)));
fs->framestack[fs->stacksize++]= (length&0xff00)>>8;
fs->framestack[fs->stacksize++]= length&0xff;
memcpy (fs->framestack + (fs->stacksize), vorbdata, length);
fs->stackcount++;
- fs->stacksize += (length);
+ fs->stacksize += length;
}
- if (length + fs->stacksize > max_payload
+ else if (length + fs->stacksize > max_payload
|| fs->stackcount >= 15 || last)
{
-
/* Set Vorbis header flags */
xr->bitfield.frag_type = 0;
xr->bitfield.data_type = 0;
@@ -294,7 +294,24 @@
fs->stackcount = 0;
free (packet);
+
+ //FIXME workaround, the whole logic should be improved
+ if (length <= max_payload){
+
+ fs->framestack = realloc (fs->framestack,
+ (fs->stacksize + (length + 2)));
+ fs->framestack[fs->stacksize++] =
+ (length&0xff00)>>8;
+ fs->framestack[fs->stacksize++] =
+ length&0xff;
+
+ memcpy (fs->framestack + (fs->stacksize),
+ vorbdata, length);
+ fs->stackcount++;
+ fs->stacksize += length;
+ }
}
+
}
/* Send header packets (under max_payload octets) - No Packing */
More information about the commits
mailing list