[Live-devel] Video Audio Streaming to Wowza streaming server

Rachit Shah rachit.shah at einfochips.com
Thu Jun 4 08:36:28 PDT 2015


Hi,

We are working on application, which is based on IOS platform, to send Video and Audio to Wowza streaming server.
Video & Audio data are captured and encoded at IOS library APIs in H.264 & AAC format then encoded Video and Audio bitstream data are passed to Wowza streaming server using Darwin-injector class.

Please find below code snippet of implementation.
We are facing issue of Video stuck on Wowza streaming server when Video and Audio both are enabled for streaming but if Video is only enabled then issue isn't observed.
Please provide your input if miss any settings.

//Function to create Client session
{
           exitEventLoop = 0;

            //CREATE SCHEDULER
    BasicTaskScheduler* scheduler = BasicTaskScheduler::createNew();
    uenv = BasicUsageEnvironment::createNew(*scheduler);

    injector = DarwinInjector::createNew(*uenv, "live");

    struct in_addr dummyDestAddress;

    dummyDestAddress.s_addr = 0;

    //set Groupsock for video
    Groupsock rtpGroupsockVideo(*uenv, dummyDestAddress, 0, 0);
    Groupsock rtcpGroupsockVideo(*uenv, dummyDestAddress, 0, 0);

    //set Groupsock for audio
    Groupsock rtpGroupsockAudio(*uenv, dummyDestAddress, 0, 0);
    Groupsock rtcpGroupsockAudio(*uenv, dummyDestAddress, 0, 0);


     //set buffer size for High resolutin.
    OutPacketBuffer::maxSize = 600000;

    //For Video Sink
    rtpVideoSink = H264VideoRTPSink::createNew(*uenv, &rtpGroupsockVideo, 96, spsByte, [sps length], ppsByte, [pps length]);
    //For Audio Sink
    rtpAudioSink = MPEG4GenericRTPSink::createNew(*uenv, &rtpGroupsockAudio, 97,44100,"audio","AAC-hbr", ConfigStr, 2);

    if( rtpVideoSink == NULL )
    {
        return;
    }

    if(rtpAudioSink == NULL )
    {

        return;
    }

    // Create (and start) a 'RTCP instance' for this RTP sink:
    const unsigned estimatedSessionBandwidthVideo = 4500; // 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

    const unsigned estimatedSessionBandwidthAudio = 160;
    //Crate RTSP client instance.
    RTCPInstance* videoRTCP =RTCPInstance::createNew(*uenv, &rtcpGroupsockVideo, estimatedSessionBandwidthVideo, CNAME, rtpVideoSink, NULL /* we're a server */);

    RTCPInstance* audioRTCP= RTCPInstance::createNew(*uenv, &rtcpGroupsockAudio, estimatedSessionBandwidthAudio, CNAME, rtpAudioSink,NULL /* we're a server */);

    // Note: This starts RTCP running automatically
    // Add audio and video stream to 'Darwin injector':
    injector->addStream(rtpVideoSink, videoRTCP);
    injector->addStream(rtpAudioSink, audioRTCP);

    //Try to connect with server with given ip ann username password.
    if(!injector->setDestination(ipaddress, appStreamName, "live","", port, username, password))
    {
            printf("Connection failed !!!!\n");

    }
    else
    {
            printf("Connection Done !!!!\n");

     }

    play();

    *uenv << "Play this stream (from the Darwin Streaming Server) using the URL:\n"
    << "\trtsp://" << "localhost" << "/" << "test.sdp" << "\n";

 env->taskScheduler().doEventLoop(&exitEventLoop); // does not return

  return 0; // only to prevent compiler warning    }

//Start playing to send data to server
void play()
{
            //VIDEO FRAMED SOURCE
    videoFramedSource = LiveSourceWithx264::createNew(*uenv);
    if(videoFileSource == NULL)
    {
        return;
    }
    FramedSource* videoES = videoFramedSource;
    videoSource = H264VideoStreamDiscreteFramer::createNew(*uenv, videoES);
    // Finally, start playing:
    rtpVideoSink->startPlaying(*videoSource, afterPlaying, rtpVideoSink);


            //AUDIO FRAMED SOURCE
    audioSource = AACFramedSource::createNew(*uenv);
    if (audioSource == NULL)
    {
        return;
    }
    // Finally, start playing:
    rtpAudioSink->startPlaying(*audioSource, afterPlaying, rtpAudioSink);
}

Here VideoFrameSource and AudioFrameSource class are derived class of FramedSource class.


Regards,
Rachit
************************************************************************************************************************************************************* eInfochips Business Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated. Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email. *************************************************************************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20150604/a2fa8bb5/attachment.html>


More information about the live-devel mailing list