[Live-devel] Is it valid to call startPlaying on a MediaSink AFTER TaskScheduler->doEventLoop()?
Ben Rush
ben at ben-rush.net
Mon Jun 27 19:29:18 PDT 2016
Awesome, so just to be clear, calling something like this:
const unsigned maxCNAMElen = 100;
unsigned char CNAME[maxCNAMElen + 1];
gethostname((char*)CNAME, maxCNAMElen);
CNAME[maxCNAMElen] = '\0'; // just in case
unsigned int destinationRtcpPortNumber = destinationRtpPortNumber + 1;
unsigned int ttl = 7;
/* struct in_addr destinationAddress;
destinationAddress.s_addr = our_inet_addr(destinationIP.c_str());*/
const Port destinationRtpPort(destinationRtpPortNumber);
const Port destinationRtcpPort(destinationRtcpPortNumber);
_rtpSock = new Groupsock(usageEnviroment, destinationAddress,
destinationRtpPort, ttl);
_rtcpSock = new Groupsock(usageEnviroment, destinationAddress,
destinationRtcpPort, ttl);
const int payloadFormatCode = 11;
const char* mimeType = "L16";
const int fSamplingFrequency = 44100;
const int fNumChannels = 1;
//return SimpleRTPSink::createNew(envir(), rtpGroupsock,
rtpPayloadTypeIfDynamic, );
_sink = SimpleRTPSink::createNew(usageEnviroment, _rtcpSock,
payloadFormatCode, fSamplingFrequency,
"audio", mimeType, fNumChannels);
// Create (and start) a 'RTCP instance' for this RTP sink:
const unsigned estimatedSessionBandwidth = 5000; // in kbps; for RTCP
b/w share
_rtcpInstance = RTCPInstance::createNew(usageEnviroment, _rtcpSock,
estimatedSessionBandwidth, CNAME,
_sink, NULL /* we're a server */, False);
//_rtcpInstance->setByeHandler(afterByeCalled, this);
unsigned char bitsPerSample = 16;
unsigned char numChannels = 1;
unsigned samplingFrequency = 44100;
unsigned granularityInMS = 20;
AudioInputDevice *source = AudioInputDevice::createNew(usageEnviroment,
1, bitsPerSample,
numChannels, samplingFrequency);
FramedSource* swappedSource = EndianSwap16::createNew(usageEnviroment,
source);
char str[512];
inet_ntop(AF_INET, &(destinationAddress.S_un.S_addr), str,
sizeof(str));
bool ret = _sink->startPlaying(*swappedSource, nullptr, _sink);
...from within afterGettingFrame() of my own MediaSink-derived class is
perfectly acceptable (this is the body of a function called once to start
sending RTP traffic back).
Correct?
On Mon, Jun 27, 2016 at 6:13 PM Ross Finlayson <finlayson at live555.com>
wrote:
> Yes, you can call any of these functions while you’re in the event loop.
> In fact, there’s no reason in principle why your “main()” function can’t
> just be nothing but a call to “doEventLoop()” - so that everything gets
> called from event handlers. (In practice, however, “main()” needs to do
> some initial setup to ensure that events start happening - before the call
> to “doEventLoop()”.)
>
> But once you’re in the event loop (and thus are handling events), you can
> call whatever functions you like.
>
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20160628/82120dab/attachment.html>
More information about the live-devel
mailing list