Dear Ross,
we are trying to stream MPEG-TS over RTP using live555 library. The main
idea is muxing two streams: an H264 video stream and an AAC audio stream,
reading each one from independent files.
In order to do this, we have constructed a little test (based on existing
live555 tests) which we include in this mail. When we execute the test, it
crashes outputting the message:
*FramedSource[0x124d290]::getNextFrame(): attempting to read more than once
at the same time!*
We have checked which *FramedSource* throws this message and we have seen
that it is *MPEG2TransportStreamFromESSource. *Moreover, we have checked
its behavior muxing only one stream at once and it does not crash.
We think that we are failing at some point linking the different modules
but we really don't know where. Any help will be appreciated.
Thanks and Regards,
----
Marc Palau Erena
i2CAT Audiovisual Unit
pd: the source code of our test
#include "liveMedia.hh"
#include "GroupsockHelper.hh"
#include "BasicUsageEnvironment.hh"
char const* vInputFileName = "in.h264";
char const* aInputFileName = "in.aac";
void afterPlaying(void* clientData); // forward
UsageEnvironment* env;
RTPSink* outputSink;
int main(int argc, char** argv) {
// Begin by setting up our usage environment:
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
// Open the video file as a 'byte-stream file source':
FramedSource* vInputSource = ByteStreamFileSource::createNew(*env,
vInputFileName);
if (vInputSource == NULL) {
*env << "Unable to open file \"" << vInputFileName
<< "\" as a byte-stream file source\n";
exit(1);
}
// Create a 'framer' filter for this file source, to generate
presentation times for each NAL unit:
H264VideoStreamFramer* framer = H264VideoStreamFramer::createNew(*env,
vInputSource, True/*includeStartCodeInOutput*/);
// Open the video file as a 'byte-stream file source':
FramedSource* aInputSource = ADTSAudioFileSource::createNew(*env,
aInputFileName);
if (aInputSource == NULL) {
*env << "Unable to open file \"" << aInputFileName
<< "\" as a ADTS file source\n";
exit(1);
}
// Then create a filter that packs the H.264 video data into a Transport
Stream:
MPEG2TransportStreamFromESSource* tsFrames =
MPEG2TransportStreamFromESSource::createNew(*env);
tsFrames->addNewVideoSource(framer, 5/*mpegVersion: H.264*/);
tsFrames->addNewAudioSource(aInputSource, 4/*mpegVersion: AAC*/);
// Create 'groupsocks' for RTP and RTCP:
char const* destinationAddressStr = "127.0.0.1";
const unsigned short rtpPortNum = 6004;
const unsigned short rtcpPortNum = rtpPortNum+1;
const unsigned char ttl = 7; // low, in case routers don't admin scope
struct in_addr destinationAddress;
destinationAddress.s_addr = our_inet_addr(destinationAddressStr);
const Port rtpPort(rtpPortNum);
const Port rtcpPort(rtcpPortNum);
Groupsock rtpGroupsock(*env, destinationAddress, rtpPort, ttl);
Groupsock rtcpGroupsock(*env, destinationAddress, rtcpPort, ttl);
// Create an appropriate 'RTP sink' from the RTP 'groupsock':
outputSink =
SimpleRTPSink::createNew(*env, &rtpGroupsock, 33, 90000, "video",
"MP2T",
1, True, False /*no 'M' bit*/);
// Create (and start) a 'RTCP instance' for this RTP sink:
const unsigned estimatedSessionBandwidth = 5000; // 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::createNew(*env, &rtcpGroupsock,
estimatedSessionBandwidth, CNAME,
outputSink, NULL /* we're a server */, False);
// Note: This starts RTCP running automatically
// Finally, start the streaming:
outputSink->startPlaying(*tsFrames, afterPlaying, NULL);
env->taskScheduler().doEventLoop(); // does not return
return 0; // only to prevent compiler warning
}
void afterPlaying(void* /*clientData*/) {
outputSink->stopPlaying();
// Note that this also closes the input file that this source read from.
exit(0);
}
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel