[Live-devel] how to stream both H264 video and AAC audio ?
Ross Finlayson
finlayson at live555.com
Tue Aug 30 00:51:51 PDT 2011
> 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.
Yes. (See, for example, how the "testOnDemandRTSPServer" demo application implements the streaming of audio+video substreams from a MPEG Program Stream: "testProgs/testOnDemandRTSPServer.cpp", lines 96-111
> 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
Actually, it's sufficient to make them "protected:", because they're called only by their ancestor class "OnDemandServerMediaSubsession".
> , so i'm wondering if i've missed something in how to set this up.
Yes - note my comments below!
Once you've sorted this all out, I suggest that you begin by testing your server with our "openRTSP" command-line client.
Another 'gotcha' that you'll face will be time synchronization. It's essential that when you set the "fPresentationTime" values for both audio and video (i.e., when you implement the two "doGetNextFrame()" virtual functions), that you set them to accurate values that are synchronized with each other.
> Also, is it OK for both Audio and Video to use the same 'GroupSock' ?
No! They must use different "Groupsock" objects. But you shouldn't be caring about this, because the "Groupsock" objects are created automatically from the "OnDemandServerMediaSubsession" code. You don't need to deal with them yourself.
I.e., your code should *not* be creating "Groupsock" objects, and it should *not* be calling "createNewStreamSource()" and "createNewRTPSink()". This is done automatically by "OnDemandServerMediaSubsession". All you need to do is define those two functions, not call them.
Again, I suggest looking at the "testOnDemandRTSPServer" code for guidance.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20110830/66d056cf/attachment-0001.html>
More information about the live-devel
mailing list