Hello Jean-Marc<br><br>We really appreciate your input.<br><br>If I understand it right, we should be calling the encoder on the same SpeexBits structure passing it a frame at a time to encode for as many times as the number of frames that we want to pack in the RTP payload.<br>
<br>The output then obtained from from the encoder will have the necessary padding at the end without any separators between individual encoded frames.<br><br>That would be really cool. Other wise I was scratching my head as to we'll have to chop the padding from each encoded frame before it can be put in the RTP payload. Lot of bit operations otherwise reqd from the appln have been saved.<br>
<br>Really appreciate your input.<br><br>Thanks and Regards,<br>-Manish S. Jalan<br><br><br><div class="gmail_quote">On Thu, Dec 10, 2009 at 5:22 PM, Jean-Marc Valin <span dir="ltr"><<a href="mailto:jean-marc.valin@usherbrooke.ca">jean-marc.valin@usherbrooke.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">You cannot concatenate bytes because Speex frames don't necessarily end<br>
on octet boundaries. You need to call the encoder multiple times on the<br>
same SpeexBits bitpacket.<br>
<br>
Jean-Marc<br>
<div><div></div><div class="h5"><br>
Manish Jalan wrote:<br>
> Hello,<br>
><br>
> _*Background:*_<br>
> The RFC 5574 suggests the RTP payload format for the speex codec. The<br>
> payload formation is straight forward; the encoded frames are to be<br>
> concatenated one after another. Once we have appended desired number of<br>
> frames, we have to pad the stream with 01111 sort of sequence to ensure<br>
> that payload ends on a octet boundary.<br>
><br>
> _*Observation:*_<br>
> I am using the speex encoder at 2150 Kbps (by setting the quality to 0).<br>
> For a frame of 20 ms ~ 160 samples (considering 8000 samples per second<br>
> as the sampling rate), the encoder is giving me encoded output of 6 bytes.<br>
> As a test case, I encoded some 10 frames one after another each time<br>
> getting 6 bytes of encoded output. I concatenated each of the 6 byte<br>
> encoded outputs.<br>
><br>
> As suggested in couple of posts I tried to decode this stream of encoded<br>
> voice by calling the decoder repeatedly until the bits remaining api<br>
> returned me a value less than 1.<br>
><br>
> What I observed was this sequence: First time the decoder returned<br>
> successful decode; Second time it returned end of stream; thrid time it<br>
> returned successful decode; fourth time it returned end of stream; ...<br>
><br>
> That is: decode success, EoS, decode success, EoS, decode success, EoS, ....<br>
><br>
> _*Hypothesis:*_<br>
> Based on the above observation, what might be happening is:<br>
> For a frame of 20 ms (=> 50 frames in a second), the encoder (running at<br>
> 2150 bps) computes 43 bits of encoded stream. Since it has to return in<br>
> terms of full bytes, it pads 01111 sequence to give a 48 bit output.<br>
> Now while decoding 43 bits are first decoded; Then 01111 sequence is<br>
> interpreted as end of stream; Then next 43 bits are decoded and 01111<br>
> is interpreted as end of stream and so on.<br>
><br>
> _*Query:*_<br>
> For Speex, when we are packing multiple encoded frames in the RTP<br>
> packet, should we,<br>
> a. pack the encoded frame in full bytes as received from the encoder<br>
> (i.e. 48 bits)<br>
> or<br>
> b. we should be chopping the end of stream marker 0 followed by 1's<br>
> (i.e. strictly 43 bits) and have the 0 followed by 1's sequence used<br>
> only for padding the payload to ensure octet boundary.<br>
><br>
> _*Reason for the query:*_<br>
> I want to implement the RTP packetization that is interoperable. If the<br>
> receiver is not in my control, it should still be able to decode the<br>
> stream that I am sending.<br>
><br>
><br>
> Regards,<br>
> Manish S. Jalan<br>
><br>
><br>
</div></div>> ------------------------------------------------------------------------<br>
><br>
> _______________________________________________<br>
> Speex-dev mailing list<br>
> <a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br>
> <a href="http://lists.xiph.org/mailman/listinfo/speex-dev" target="_blank">http://lists.xiph.org/mailman/listinfo/speex-dev</a><br>
</blockquote></div><br><br>