[Live-devel] Send and receive wav (streaming)
Ross Finlayson
finlayson at live.com
Mon Apr 5 11:18:01 PDT 2004
Andreas,
If you haven't already done so, please read the "Frequently Asked
Questions" (FAQ) file: <http://www.live.com/liveMedia/faq.html>
>We are currently working on a project where we are supposed to make this
>half-duplex voice communication program. We have managed to send a WAV
>file from
>one computer to another, but on its way there it gets corrupt somehow.
>When we
>do this with a MP3 file (according to the test program) it works just fine.
Note that there is also a test program - "testWAVAudioStreamer" - for
streaming a WAV audio file (via multicast). You can also use
"testOnDemandRTSPServer" to stream a WAV audio file via unicast.
>We are using the testMP3Streamer.cpp as a model
No, you should instead use "testWAVAudioStreamer.cpp" as a model, as it
probably already does most (if not all?) of what you want. You can also
use "VLC" (or QuickTime Player) to receive/play the stream.
> and we are using this source and
>sink. In the case of SimpleRTPSink, what do we put where it says xxx? We
>have no
>requirements on audio compression in this stage, so what is the simplest
>thing
>here? We may want to add an AMR codec later on...
>
>rtpSource = SimpleRTPSource::createNew(*env, &rtpGroupsock, 0, 8000,
>"audio/raw");
>
>sessionState.sink = SimpleRTPSink::createNew(*env,
>sessionState.rtpGroupsock, 0,
>8000, "audio/raw", xxx);
First, "audio/raw" is the incorrect MIME type. The correct MIME type is
"audio/L16" (for 16-bit audio samples), or "audio/L8" (for 8-bit audio
samples). You may not think that this matters much, because you're
developing your own sender/receiver application, but it's important if you
also want your stream to be receivable/playable by other, standard media
players (such as QuickTime Player or VLC).
Second, your parameter signature for "SimpleRTPSink" is incorrect. Please
see "testWAVAudioStreamer" (and "liveMedia/include/SimpleRTPSink.hh") for
the correct usage.
Finally, your parameter signature for "SimpleRTPSource" (for receiving the
network stream) is correct, but the parameters that you're passing are
incorrect:
- As noted above, the MIME type "audio/raw" is incorrect.
- The payload format parameter 0 is incorrect. (That payload
format means u-law audio - see RFC 3551, section 6.) Instead, use payload
format code 10 (for streaming 44100 Hz, 2-channel, 16-bit samples), 11 (for
streaming 44100 Hz, 1-channel, 16-bit samples), or a dynamic payload format
code (i.e., >= 96) for other types of audio. Again, see
"testWAVAudioStreamer.cpp" (and RFC 3551).
- In this case, the RTP timestamp frequency must be the same as
the audio sampling frequency (so, 8000 may or may not be correct).
Ross Finlayson
LIVE.COM
<http://www.live.com/>
More information about the live-devel
mailing list