[Live-devel] how to stream both H264 video and AAC audio ?
Ken Dunne
ken at starseedsoft.com
Mon Aug 29 17:53:07 PDT 2011
Hi;
I've gotten H264 streaming to work, thanks to the live555 and old posts to this list.
Now, i am trying to add audio to the same stream.
I've been reading through old posts in this list, and have gathered that to have the audio and video taken together, that i must add both to the same ServerMediaSession. I've also read, for AAC, that i need to make a class (AACSMS) based on 'ADTSAudioFileServerMediaSubsession' and provide the guts of 'createNewStreamSource' and 'createNewRTPSink', which i have done. I have made 'AACSMS' inherit from 'OnDemandServerMediaSubsession' since it is a live AAC source. I have also created a class that acquires the live frames 'AACLiveSource', a subclass of FramedSource, which is created within 'createNewStreamSource'
My question is how to put this all together correctly. I have had to make the AACSMS two 'create' members public in order to do this, so i'm wondering if i've missed something in how to set this up. Also, is it OK for both Audio and Video to use the same 'GroupSock' ?
Thanks for your clarifications!
-------------------------
Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
RTSPServer* rtspServer = RTSPServer::createNew(*env, 8554);
ServerMediaSession* sms = ServerMediaSession::createNew(*env, "testStream", "Streaming live H264", "xxx", True );
//Video subsession: (works, no problems)
MediaSource* videoSource = H264VideoStreamDiscreteFramer::createNew(*env, videoRawBuffer);
RTPSink* videoSink = H264VideoRTPSink::createNew(*env, &rtpGroupsock, 96);
ServerMediaSubsession* subsessionVideo = PassiveServerMediaSubsession::createNew(*videoSink, rtcp);
sms->addSubsession(subsessionVideo);
//Audio subsession:
// for audio that is linked to this video, add a second subsession
AACSMS* subsessionAudio = AACSMS::createNew(*env, true);
// the AACLiveSource instance:
FramedSource* audioSource = subsessionAudio->createNewStreamSource(1, estBitrate);
RTPSink* audioSink = subsessionAudio->createNewRTPSink( &rtpGroupsock, 97, audioSource);
sms->addSubsession(subsessionAudio);
rtspServer->addServerMediaSession(sms);
-------------------------
More information about the live-devel
mailing list