[Live-devel] Adding Audio Stream Session
Ashfaque
ashfaque at iwavesystems.com
Tue Mar 5 03:19:50 PST 2013
Hi Ross,
Been using Live555 for Video streaming on multiple platforms, used on Linux, iOS and now ported to WinCE7. Video streaming works like a charm.
Now I want to add the audio stream in the media session. As a test I want stream a mp3 file with video stream (H.264 video data generated by a encoder source).
I am assuming to use MP3AudioFileServerMediaSubsession as audio subsession and add it to ServerMediaSession.
Below is my code:
const Port rtpPort(rtpPortNum);
const Port rtcpPort(rtcpPortNum);
Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
rtpGroupsock.multicastSendOnly(); // we're a SSM source
Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);
rtcpGroupsock.multicastSendOnly(); // we're a SSM source
// Create a 'H264 Video RTP' sink from the RTP 'groupsock':
OutPacketBuffer::maxSize = 500000;
videoSink = H264VideoRTPSink::createNew(*env, &rtpGroupsock, 96);
// Create (and start) a 'RTCP instance' for this RTP sink:
const unsigned estimatedSessionBandwidth = 500; // in kbps; for RTCP b/w share
const unsigned maxCNAMElen = 100;
unsigned char CNAME[maxCNAMElen+1];
gethostname((char*)CNAME, maxCNAMElen);
CNAME[maxCNAMElen] = '\0'; // just in case
RTCPInstance* rtcp
= RTCPInstance::createNew(*env, &rtcpGroupsock,
estimatedSessionBandwidth, CNAME,
videoSink, NULL /* we're a server */,
True /* we're a SSM source */);
// Note: This starts RTCP running automatically
RTSPServer* rtspServer = RTSPServer::createNew(*env, 8554);
if (rtspServer == NULL) {
*env << "Failed to create RTSP server: " << env->getResultMsg() << "\n";
exit(1);
}
ServerMediaSession* sms
= ServerMediaSession::createNew(*env, "testStream", inputFileName,
"Session streamed by \"testH264VideoStreamer\"",
True /*SSM*/);
ServerMediaSubsession* VideoSession = NULL;
VideoSession = PassiveServerMediaSubsession::createNew(*videoSink, rtcp);
sms->addSubsession(VideoSession);
//rtspServer->addServerMediaSession(sms);
ServerMediaSubsession* AudioSession = NULL;
AudioSession = MP3AudioFileServerMediaSubsession
::createNew(*env, inputaudioFileName, reuseFirstSource,
true, NULL);
sms->addSubsession(AudioSession);
rtspServer->addServerMediaSession(sms);
char* url = rtspServer->rtspURL(sms);
Please let me know whether this is the correct method of adding audio stream with video. I don’t have a audio codec source, hence want to test with MP3 file only.
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130305/f6bdf276/attachment.html>
More information about the live-devel
mailing list