[Live-devel] Adding secondary audio track to existing H264 RTP stream
Marcin
marcin at speed666.info
Thu Mar 29 04:50:29 PDT 2018
Thanks Ross,
I did that as you said with ADTSFileSource but i have a problem. After
your change it start to works but not as good as it shold.
In example - below code was running for 30 seconds and produced 20s AAC
audio file.
If it try to stream the same file using RTPSink and RTSP Server -
streams works okay.
CPU is 1% on ARM device.
What am i doing wrong?
Below is simplest code i could do:
TaskScheduler* scheduler = BasicTaskScheduler::createNew();
env = BasicUsageEnvironment::createNew(*scheduler);
fp = fopen("teststream.aac", "w");
const char* audioid = "out441.aac";
ADTSAudioFileSource* aacsource =
ADTSAudioFileSource::createNew(*env, audioid );
DummySink* outputSink = DummySink::createNew2(*env,"audio");
outputSink->startPlaying(*aacsource, NULL, NULL);
env->taskScheduler().doEventLoop(&eventLoopWatchVariable);
In DummySink::afterGettingFrame i just fwrite buffer to file, nothing more.
Marcin
W dniu 28.03.2018 o 22:47, Ross Finlayson pisze:
> Marcin,
>
> Reading your email once again, I realized that my first response wasn’t a proper answer to your question - because you are not transmitting the audio data (over RTP), but are instead are recording it into a Transport Stream file. Because of this, you *do*, indeed, need to call "scheduleDelayedTask()” yourself - because our Transport Stream multiplexing code (“MPEG2TransportStreamFromESSource.cpp”) currently doesn’t do anything with the “durationInMicroseconds” parameter that it gets passed from the upstream source. (That multiplexing code was written with the assumption that all input sources (for the Transport Stream) will be ‘live’ input sources (rather than pre-recorded data). That’s not the case for your application.)
>
> Fortunately, there’s an easy way for you to do this - by changing the last statement (lines 169-170) of “ADTSFileSource.cpp” from
> nextTask() = envir().taskScheduler().scheduleDelayedTask(0, (TaskFunc*)FramedSource::afterGetting, this);
> to
> nextTask() = envir().taskScheduler().scheduleDelayedTask(fDurationInMicroseconds, (TaskFunc*)FramedSource::afterGetting, this);
>
> (As always, I don’t recommend changing our code ‘in place’. Instead, you should define your own class name - e.g., “ModifiedADTSFileSource” - and just copy the code from “ADTSFileSource.cpp” as appropriate.)
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel
More information about the live-devel
mailing list