[Live-devel] Problems with Streaming of AMR

Ross Finlayson finlayson at live555.com
Fri Nov 3 07:24:20 PST 2006


>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];

Sorry - my mistake.  I had forgotten how the FFMPEG encoder works, 
and what "AMRAudioRTPSink"s requirements are.  I had it all 
backwards.  In fact, when delivering AMR frames to "AMRAudioRTPSink", 
we *don't* want to include the 1-byte header in each frame (because 
it instead gets included in a special RTP header).  However, the 
FFMPEG encoder, by default, *does* include the 1-byte header in each 
frame, so we had to change the FFMPEG code, and, in the code that 
calls the FFMPEG code, do:

	extern int EncoderIncludeHeaderByte;
	EncoderIncludeHeaderByte = 0;
and, for each frame
	fLastFrameHeader = toc_byte[ourAMRMode];
See "AMRAudioEncoder.cpp" in the "wis-streamer" code.

Note that the change that I made to FFMPEG's "interf_enc.c" means 
that - by default - it works the same way as it did before (as you 
noted).  It's only when the calling code sets
	EncoderIncludeHeaderByte = 0;
that it behaves differently.

I hope that clears things up.
-- 

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


More information about the live-devel mailing list