[Live-devel] Problems with Streaming of AMR
Martin
marthi at graphics.cs.uni-sb.de
Fri Nov 3 03:17:30 PST 2006
Hi,
Ross Finlayson wrote:
>>So as you suggested I looked into the wis-streamer code as well and
>>included the part for the AMR-header:
>>
>>enum Mode ourAMRMode = MR122; // the only mode that we support
>>fLastFrameHeader = toc_byte[ourAMRMode];
>>fNumTruncatedBytes = 0;
>>
>>But on the receiver side the frame is still to short:
>>
>>[amr_nb @ 0xb45fc008]amr frame too short (31, should be 32)
>>
>>Maybe I'm still missing something?
>
>
> You're probably forgetting - in your encoder - to adjust the returned
> frame size to allow for the extra 1-byte header. Search for
> "EncoderIncludeHeaderByte" in "AMREncoder/interf_enc.c" in the
> "wis-streamer" code, to see where I had to modify the existing FFMPEG
> code to do this.
thanks for uour help so far! I looked at the "wis-streamer" code but I
don't really understand what you changed:
Your code:
int EncoderIncludeHeaderByte = 1;
static int EncoderMMS( enum Mode mode, Word16 *param, UWord8 *stream, enum
TXFrameType frame_type, enum Mode speech_mode )
{
Word32 j = 0, k;
Word16 *mask;
int resultFrameSize = block_size[mode] - !EncoderIncludeHeaderByte;
memset(stream, 0, resultFrameSize);
if (EncoderIncludeHeaderByte) {
*stream = toc_byte[mode];
stream++;
}
[...]
return resultFrameSize;
If I'm getting it right, the resultFrameSize is evaluated to
block_size[mode] (because !EncoderIncludeHeaderByte = 0).
So the code is the same as before:
static int EncoderMMS( enum Mode mode, Word16 *param, UWord8 *stream, enum
TXFrameType frame_type, enum Mode speech_mode )
{
memset(stream, 0, block_size[mode]);
*stream = toc_byte[mode];
stream++;
[...]
return block_size[mode];
It would be great if you could give me some further explanation.
Probably I don't see the obvious point...
Moreover, I want to leave the ffmpeg-code as is (if possible) and
include the header after the encoding step of ffmpeg:
avcodec_encode_audio(...,&buffer,...)
shift buffer 1 position to the right
buffer[0] = header.
Or do I completely misunderstand the "header-thing"?
Thanks in advance!
Martin
More information about the live-devel
mailing list