WebRtc Audio transferring stopped after few seconds

230 views Asked by At

From last few days I'm working on WebRtc I setup everything at server side and android side also, but when I call via an Android device, after few seconds audio transferring stopped while it's working fine web to web, so what am I doing wrong at android side.

Here is the code which I am using for setting up WebRtc

 PeerConnectionFactory.initializeAndroidGlobals(listener, true, true, 
 params.videoCodecHwAcceleration, mEGLcontext);

 factory = new PeerConnectionFactory();
 localMS = factory.createLocalMediaStream("ARDAMS");

 pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
 pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"));
 pcConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
 pcConstraints.optional.add(new MediaConstraints.KeyValuePair("internalSctpDataChannels", "true"));

 if(pcParams.videoCallEnabled){
        MediaConstraints videoConstraints = new MediaConstraints();
        videoConstraints.mandatory.add(new MediaConstraints.KeyValuePair("maxHeight", Integer.toString(pcParams.videoHeight)));
        videoConstraints.mandatory.add(new MediaConstraints.KeyValuePair("maxWidth", Integer.toString(pcParams.videoWidth)));
        videoConstraints.mandatory.add(new MediaConstraints.KeyValuePair("maxFrameRate", Integer.toString(pcParams.videoFps)));
        videoConstraints.mandatory.add(new MediaConstraints.KeyValuePair("minFrameRate", Integer.toString(pcParams.videoFps)));

        videoSource = factory.createVideoSource(getVideoCapturer(), videoConstraints);
        localMS.addTrack(factory.createVideoTrack("ARDAMSv0", videoSource));
    }

 MediaConstraints audioConstraints = new MediaConstraints();
 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair(AUDIO_ECHO_CANCELLATION_CONSTRAINT, "true"));
 audioConstraints.mandatory.add(new MediaConstraints.KeyValuePair(AUDIO_NOISE_SUPPRESSION_CONSTRAINT, "true"));

 AudioSource audioSource = factory.createAudioSource(audioConstraints);

 localMS.addTrack(factory.createAudioTrack("ARDAMSa0", audioSource));

 mListener.onLocalStream(localMS);
0

There are 0 answers