Hi Ross,

Thanks a lot for answering.

On 02/20/2013 02:51 AM, Ross Finlayson wrote:
I have problems streaming live PCM audio. Audio comes either directly
from microphone (16-bit LE) or from hardware encoder (A-LAW).

The problem is that a-law audio is *not* PCM, and therefore has a different RTP payload format (if a-law audio is what you're sending).

Specifically, if you're streaming a-law audio, then when you create your "SimpleRTPSink" object, the "rtpPayloadFormatName" parameter should be "PCMA" (and, of course, the "sdpMediaTypeString" parameter will be "audio").  Because a-law audio is 8-bits per sample, you don't do any byte swapping.

If, on the other hand, you are converting the audio from (8-bit) a-law to (16-bit) PCM before streaming it, then you need to (1) make sure that the 16-bit audio is in big-endian order, and (2) use "L16" as the "rtpPayloadFormatName" parameter when you create your "SimpleRTPSink".

When streaming a-law I do set mime type to "PCMA", "sdpMediaTypeString" parameter to "audio" and payloadFormatCode to 8, as
it's done in testWAVAudioStreamer. VLC detects the stream as PCM ALAW, so I don't think that is my problem. However there's a strong
echo and noise in my stream, which do not exist when streaming from file.

I know that audio is correct, because if I save it to file instead of sending to
RTPSink, convert to WAV and stream via testWAVAudioStreamer, VLC reproduces
it correctly.

That works because (presumably) there's an appropriate header in the WAV file that tells "testWAVAudioStreamer" what kind of audio this is.  If you run "testRTSPClient" on the stream, and look at the SDP description, you'll see the proper RTP payload format name name ("PCMA" or "L16") for this audio.

After saving a-law samples to file I use the following command to convert it to WAV:

sox -b 8 -e a-law -r 8000 -c 1  test.raw test.wav

Maybe something is wrong with the way I bundle samples for RTP sink, or the way I time-stamp them ?
WAVAudioFileStreamer class tries to read several samples from the file, up to 20 ms, but I already get
a buffer of 160 bytes, which is exactly 20ms for a-law. I set fPresentationTime on that buffer.
Should I play with OutPacketBuffer::maxSize ?

Thanks a lot for your help so far.

Felix.

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to