flutter-webrtc icon indicating copy to clipboard operation
flutter-webrtc copied to clipboard

Cannot connect when on different networks

Open marcoberetta96 opened this issue 3 years ago • 19 comments

I'm testing a WebRTC call and everything works fine when both the devices are on the same network. The call does not start (from every device I cannot see the other peer stream) if the devices are on different networks.

I'm creating the rtcPeerConnection using Google stun, so I think it should work.

    RTCPeerConnection rtcPeerConnection = await createPeerConnection(
      {
        ...{
          'iceServers': [
            {'url': 'stun:stun.l.google.com:19302'}
          ]
        },
        'sdpSemantics': 'uinified-plan'
      },
      {
        'mandatory': {},
        'optional': [
          {'DtlsSrtpKeyAgreement': true},
        ]
      },
    );

and then I send the offer to the other peer RTCSessionDescription offer = await rtcPeerConnection.createOffer();

Am I missing something?

Here the log of one of the two peer, if useful.
D/FLTFireMsgReceiver(23025): broadcast received for message
I/org.webrtc.Logging(23025): NativeLibrary: Loading native library: jingle_peerconnection_so
I/org.webrtc.Logging(23025): NativeLibrary: Loading library: jingle_peerconnection_so
I/org.webrtc.Logging(23025): PeerConnectionFactory: PeerConnectionFactory was initialized without an injected Loggable. Any existing Loggable will be deleted.
I/org.webrtc.Logging(23025): EglBase14Impl: SDK version: 31. isEGL14Supported: true
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
I/org.webrtc.Logging(23025): WebRtcAudioManagerExternal: Sample rate is set to 48000 Hz
I/org.webrtc.Logging(23025): WebRtcAudioManagerExternal: Sample rate is set to 48000 Hz
I/org.webrtc.Logging(23025): JavaAudioDeviceModule: createAudioDeviceModule
I/org.webrtc.Logging(23025): JavaAudioDeviceModule: HW NS will be used.
I/org.webrtc.Logging(23025): JavaAudioDeviceModule: HW AEC will be used.
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: ctor@[name=main, id=2]
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: ctor@[name=main, id=2]
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: ctor@[name=main, id=2]
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: enableBuiltInAEC(true)
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: setAEC(true)
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: enableBuiltInNS(true)
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: setNS(true)
I/org.webrtc.Logging(23025): PeerConnectionFactory: onWorkerThreadReady
I/org.webrtc.Logging(23025): PeerConnectionFactory: onNetworkThreadReady
I/org.webrtc.Logging(23025): PeerConnectionFactory: onSignalingThreadReady
I/org.webrtc.Logging(23025): EglRenderer: Initializing EglRenderer
I/org.webrtc.Logging(23025): EglRenderer: EglBase.create shared context
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
I/org.webrtc.Logging(23025): EglRenderer: Initializing EglRenderer
I/org.webrtc.Logging(23025): EglRenderer: EglBase.create shared context
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
I/FlutterWebRTCPlugin(23025): getUserMedia(audio): mandatory: [], optional: [googNoiseSuppression: true, googEchoCancellation: true, echoCancellation: true, googEchoCancellation2: true, googDAEchoCancellation: true]
I/FlutterWebRTCPlugin(23025): getUserMedia(video): com.cloudwebrtc.webrtc.utils.ConstraintsMap@cbe993c
D/FlutterWebRTCPlugin(23025): Creating video capturer using Camera2 API.
D/FlutterWebRTCPlugin(23025): Create front camera 1 succeeded
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
I/org.webrtc.Logging(23025): CameraCapturer: startCapture: 720x480@15
D/FlutterWebRTCPlugin(23025): changeCaptureFormat: 720x480@15
I/org.webrtc.Logging(23025): Camera2Session: Create new camera2 session on camera 1
I/org.webrtc.Logging(23025): Camera2Session: start
D/FlutterWebRTCPlugin(23025): MediaStream id: 34449b3c-b034-4833-829d-5567889ade24
W/FlutterWebRTCPlugin(23025): FlutterRTCVideoRenderer.setVideoTrack, set video track to aaa6c6b6-212b-45b5-97a0-fc6c440f5e16
I/org.webrtc.Logging(23025): EglRenderer: Releasing.
I/org.webrtc.Logging(23025): EglRenderer: eglBase detach and release.
I/org.webrtc.Logging(23025): Camera2Session: Available preview sizes: [3264x2448, 2688x1512, 2688x1344, 2592x1944, 2048x1536, 1920x1440, 1920x1080, 1600x1200, 1920x960, 1280x960, 1280x768, 1280x720, 1024x768, 800x400, 800x600, 800x480, 720x480, 640x480, 640x400, 640x360, 352x288, 320x240, 176x144]
I/org.webrtc.Logging(23025): Camera2Session: Available fps ranges: [[15.0:15.0], [7.0:30.0], [15.0:30.0], [30.0:30.0]]
I/org.webrtc.Logging(23025): Camera2Session: Using capture format: 720x480@[15.0:15.0]
I/org.webrtc.Logging(23025): Camera2Session: Opening camera 1
I/org.webrtc.Logging(23025): EglRenderer: Releasing done.
I/org.webrtc.Logging(23025): EglRenderer: Initializing EglRenderer
D/FlutterWebRTCPlugin(23025): CameraEventsHandler.onCameraOpening: cameraName=1
I/org.webrtc.Logging(23025): EglRenderer: Quitting render thread.
I/org.webrtc.Logging(23025): EglRenderer: EglBase.create shared context
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
D/RTCAudioManager(23025): ctor
D/RTCBluetoothManager(23025): create@[name=main, id=2]
D/RTCBluetoothManager(23025): ctor
D/RTCAudioManager(23025): useSpeakerphone: auto
D/RTCProximitySensor(23025): RTCProximitySensor@[name=main, id=2]
D/RTCAudioManager(23025): defaultAudioDevice: SPEAKER_PHONE
D/RTCAudioManager(23025): Android SDK: 31, Release: 12, Brand: google, Device: sargo, Id: SP1A.210812.015, Hardware: sargo, Manufacturer: Google, Model: Pixel 3a, Product: sargo
D/RTCAudioManager(23025): start
D/RTCAudioManager(23025): AudioManager starts...
W/AudioManager(23025): Use of stream types is deprecated for operations other than volume control
W/AudioManager(23025): See the documentation of requestAudioFocus() for what to use instead with android.media.AudioAttributes to qualify your playback use case
I/org.webrtc.Logging(23025): Camera2Session: Camera opened.
D/RTCAudioManager(23025): Audio focus request granted for VOICE_CALL streams
I/org.webrtc.Logging(23025): Camera2Session: Camera capture session configured.
D/RTCBluetoothManager(23025): start
I/org.webrtc.Logging(23025): Camera2Session: Using video stabilization.
I/org.webrtc.Logging(23025): Camera2Session: Auto-focus is not available.
I/org.webrtc.Logging(23025): Camera2Session: Camera device successfully started.
I/org.webrtc.Logging(23025): CameraCapturer: Create session done. Switch state: IDLE
I/org.webrtc.Logging(23025): SurfaceTextureHelper: Setting listener to org.webrtc.-$$Lambda$Camera2Session$CaptureSessionCallback$UDvzHNj8-cAJE1WNByx98pxD9vA@a11421f
D/RTCBluetoothManager(23025): BluetoothAdapter: enabled=false, state=OFF, name=Pixel 3a, address=02:00:00:00:00:00
D/RTCBluetoothManager(23025): HEADSET profile state: DISCONNECTED
D/RTCBluetoothManager(23025): Bluetooth proxy for headset profile has started
D/RTCBluetoothManager(23025): start done: BT state=HEADSET_UNAVAILABLE
D/RTCAudioManager(23025): --- updateAudioDeviceState: wired headset=false, BT state=HEADSET_UNAVAILABLE
D/RTCAudioManager(23025): Device status: available=[], selected=NONE, user selected=NONE
D/RTCAudioManager(23025): setAudioDeviceInternal(device=SPEAKER_PHONE)
D/RTCAudioManager(23025): New device status: available=[SPEAKER_PHONE, EARPIECE], selected=SPEAKER_PHONE
D/FlutterWebRTCPlugin(23025): onAudioManagerDevicesChanged: [SPEAKER_PHONE, EARPIECE], selected: SPEAKER_PHONE
D/RTCAudioManager(23025): --- updateAudioDeviceState done
D/RTCAudioManager(23025): AudioManager started
D/RTCAudioManager(23025): WiredHeadsetReceiver.onReceive@[name=main, id=2]: a=android.intent.action.HEADSET_PLUG, s=unplugged, m=no mic, n=null, sb=true
D/RTCAudioManager(23025): --- updateAudioDeviceState: wired headset=false, BT state=HEADSET_UNAVAILABLE
D/RTCAudioManager(23025): Device status: available=[SPEAKER_PHONE, EARPIECE], selected=SPEAKER_PHONE, user selected=NONE
D/RTCAudioManager(23025): --- updateAudioDeviceState done
D/FlutterWebRTCPlugin(23025): CameraEventsHandler.onFirstFrameAvailable
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 12.
D/FlutterWebRTCPlugin(23025): addStreamcom.cloudwebrtc.webrtc.utils.AnyThreadResult@6bff307
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: enableBuiltInAEC(true)
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: setAEC(true)
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: enableBuiltInNS(true)
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: setNS(true)
I/org.webrtc.Logging(23025): NetworkMonitor: Start monitoring with native observer 479213069552
W/org.webrtc.Logging(23025): NetworkMonitorAutoDetect: Unable to obtain permission to request a cellular network.
I/org.webrtc.Logging(23025): NetworkMonitorAutoDetect: Network becomes available: 257
D/FlutterWebRTCPlugin(23025): onIceGatheringChangeGATHERING
I/org.webrtc.Logging(23025): NetworkMonitorAutoDetect: capabilities changed: [ Transports: CELLULAR Capabilities: MMS&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED&NOT_VCN_MANAGED LinkUpBandwidth>=15000Kbps LinkDnBandwidth>=9968Kbps Specifier: <TelephonyNetworkSpecifier [mSubId = 2]>]
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
I/org.webrtc.Logging(23025): NetworkMonitorAutoDetect: link properties changed
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
D/FlutterWebRTCPlugin(23025): onIceCandidate
I/org.webrtc.Logging(23025): EglRenderer: Duration: 4015 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: ,0. Average render time: NA. Average swapBuffer time: NA.
I/org.webrtc.Logging(23025): NetworkMonitorAutoDetect: capabilities changed: [ Transports: CELLULAR Capabilities: MMS&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED&NOT_VCN_MANAGED LinkUpBandwidth>=15000Kbps LinkDnBandwidth>=6330Kbps Specifier: <TelephonyNetworkSpecifier [mSubId = 2]>]
I/org.webrtc.Logging(23025): EglRenderer: Duration: 4005 ms. Frames received: 53. Dropped: 0. Rendered: 53. Render fps: 13,2. Average render time: 3445 us. Average swapBuffer time: 916 us.
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 15.
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: enableBuiltInAEC(true)
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: setAEC(true)
I/org.webrtc.Logging(23025): WebRtcAudioRecordExternal: enableBuiltInNS(true)
I/org.webrtc.Logging(23025): WebRtcAudioEffectsExternal: setNS(true)
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: initPlayout(sampleRate=48000, channels=1, bufferSizeFactor=1.0)
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: byteBuffer.capacity: 960
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: minBufferSizeInBytes: 3848
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: createAudioTrackOnLollipopOrHigher
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: nativeOutputSampleRate: 48000
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: AudioTrack: session ID: 18145, channels: 1, sample rate: 48000, max gain: 1.0
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: AudioTrack: buffer size in frames: 1924
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: AudioTrack: buffer capacity in frames: 1924
I/org.webrtc.Logging(23025): VolumeLogger: start@[name=worker_thread - 23383, id=90]
I/org.webrtc.Logging(23025): VolumeLogger: audio mode is: MODE_IN_COMMUNICATION
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: startPlayout
I/org.webrtc.Logging(23025): VolumeLogger: VOICE_CALL stream volume: 1 (max=7)
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: AudioTrackThread@[name=AudioTrackJavaThread, id=105]
I/org.webrtc.Logging(23025): WebRtcAudioTrackExternal: doAudioTrackStateCallback: 0
I/org.webrtc.Logging(23025): AndroidVideoDecoder: ctor name: c2.qti.vp8.decoder type: VP8 color format: 19 context: org.webrtc.EglBase14Impl$Context@9ab671e
I/org.webrtc.Logging(23025): AndroidVideoDecoder: ctor name: c2.qti.vp9.decoder type: VP9 color format: 19 context: org.webrtc.EglBase14Impl$Context@9ab671e
I/org.webrtc.Logging(23025): AndroidVideoDecoder: ctor name: c2.qti.avc.decoder type: H264 color format: 19 context: org.webrtc.EglBase14Impl$Context@9ab671e
I/org.webrtc.Logging(23025): AndroidVideoDecoder: ctor name: c2.android.avc.decoder type: H264 color format: 19 context: org.webrtc.EglBase14Impl$Context@9ab671e
D/FlutterWebRTCPlugin(23025): onAddTrack
D/FlutterWebRTCPlugin(23025): onAddTrack
D/FlutterWebRTCPlugin(23025): onConnectionChangeCONNECTING
I/org.webrtc.Logging(23025): HardwareVideoEncoder: initEncode: 720 x 480. @ 300kbps. Fps: 60 Use surface mode: true
W/FlutterWebRTCPlugin(23025): FlutterRTCVideoRenderer.setVideoTrack, set video track to 7B92AB96-C560-487C-B1F3-BB9FBEEE616C
I/org.webrtc.Logging(23025): EglRenderer: Releasing.
I/org.webrtc.Logging(23025): EglRenderer: eglBase detach and release.
I/org.webrtc.Logging(23025): EglRenderer: Releasing done.
I/org.webrtc.Logging(23025): EglRenderer: Quitting render thread.
I/org.webrtc.Logging(23025): EglRenderer: Initializing EglRenderer
I/org.webrtc.Logging(23025): EglRenderer: EglBase.create shared context
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
D/CCodec  (23025): allocate(c2.qti.vp8.encoder)
I/Codec2Client(23025): Available Codec2 services: "default" "software"
I/CCodec  (23025): setting up 'default' as default (vendor) store
I/CCodec  (23025): Created component [c2.qti.vp8.encoder]
D/CCodecConfig(23025): read media type: video/x-vnd.on2.vp8
D/ReflectedParamUpdater(23025): extent() != 1 for single value type: output.buffers.pool-ids.values
D/CCodecConfig(23025): ignoring local param raw.color (0xc2001809) as it is already supported
I/CCodecConfig(23025): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig(23025): c2 config diff is Dict {
D/CCodecConfig(23025):   c2::u32 algo.bitrate-mode.value = 3
D/CCodecConfig(23025):   c2::i32 algo.priority.value = -1
D/CCodecConfig(23025):   c2::u32 algo.quality.value = 50
D/CCodecConfig(23025):   c2::float algo.rate.value = 4.2039e-44
D/CCodecConfig(23025):   c2::u32 coded.bitrate.value = 20000000
D/CCodecConfig(23025):   c2::float coded.frame-rate.value = 30
D/CCodecConfig(23025):   c2::u32 coded.pl.level = 28672
D/CCodecConfig(23025):   c2::u32 coded.pl.profile = 28672
D/CCodecConfig(23025):   c2::u32 coded.vui.color.matrix = 0
D/CCodecConfig(23025):   c2::u32 coded.vui.color.primaries = 0
D/CCodecConfig(23025):   c2::u32 coded.vui.color.range = 0
D/CCodecConfig(23025):   c2::u32 coded.vui.color.transfer = 0
D/CCodecConfig(23025):   c2::i32 coding.gop.intra-period = 1
D/CCodecConfig(23025):   c2::u32 coding.request-sync-frame.value = 0
D/CCodecConfig(23025):   c2::u32 default.color.matrix = 0
D/CCodecConfig(23025):   c2::u32 default.color.primaries = 0
D/CCodecConfig(23025):   c2::u32 default.color.range = 0
D/CCodecConfig(23025):   c2::u32 default.color.transfer = 0
D/CCodecConfig(23025):   c2::u32 input.delay.value = 8
D/CCodecConfig(23025):   string input.media-type.value = "video/raw"
D/CCodecConfig(23025):   c2::u32 output.buffers.prepend-header.value = 2
D/CCodecConfig(23025):   c2::u32 output.delay.value = 8
D/CCodecConfig(23025):   string output.media-type.value = "video/x-vnd.on2.vp8"
D/CCodecConfig(23025):   c2::u32 raw.color.matrix = 0
D/CCodecConfig(23025):   c2::u32 raw.color.primaries = 0
D/CCodecConfig(23025):   c2::u32 raw.color.range = 0
D/CCodecConfig(23025):   c2::u3
W/ColorUtils(23025): expected specified color aspects (0:0:0:0)
I/flutter (23025): 0
I/org.webrtc.Logging(23025): HardwareVideoEncoder: Format: {color-format=2130708361, i-frame-interval=100, mime=video/x-vnd.on2.vp8, width=720, bitrate-mode=2, bitrate=300000, frame-rate=60, height=480}
D/CodecSeeding(23025): Seed: codec c2.qti.vp8.encoder, mediatype video/x-vnd.on2.vp8, overrideable 1
D/CodecProperties(23025): setTuningValue(vq-target-bpp,0)
D/CodecProperties(23025): setFeatureValue(_vq_eligible.device,1)
D/CodecProperties(23025): setFeatureValue(_quality.target,1)
D/CodecSeeding(23025): Seed: codec c2.qti.vp8.encoder, mediatype video/x-vnd.on2.vp8, overrideable 0
D/VQApply (23025): minquality: applies only to VBR encoding
D/MediaCodec(23025): shapeMediaFormat: deltas(0): AMessage(what = 0x00000000) = {
D/MediaCodec(23025):   }
D/CCodec  (23025): [c2.qti.vp8.encoder] buffers are bound to CCodec for this session
D/CCodecConfig(23025): no c2 equivalents for color-format
D/CCodecConfig(23025): no c2 equivalents for flags
D/CCodecConfig(23025): no c2 equivalents for encoder
D/CCodecConfig(23025): c2 config diff is   c2::u32 algo.bitrate-mode.value = 1
D/CCodecConfig(23025):   c2::u32 coded.bitrate.value = 300000
D/CCodecConfig(23025):   c2::float coded.frame-rate.value = 60
D/CCodecConfig(23025):   c2::i32 coding.gop.intra-period = 6000
D/CCodecConfig(23025):   c2::u32 raw.pixel-format.value = 34
D/CCodecConfig(23025):   c2::u32 raw.size.height = 480
D/CCodecConfig(23025):   c2::u32 raw.size.width = 720
W/ColorUtils(23025): expected specified color aspects (0:0:0:0)
W/Codec2Client(23025): query -- param skipped: index = 1107298332.
W/Codec2Client(23025): query -- param skipped: index = 3254781982.
D/CCodec  (23025): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  (23025):   int32_t android._color-format = 2130708361
D/CCodec  (23025):   Rect crop(0, 0, 719, 479)
D/CCodec  (23025):   int32_t color-standard = 0
D/CCodec  (23025):   int32_t color-range = 0
D/CCodec  (23025):   int32_t color-transfer = 0
D/CCodec  (23025):   int32_t frame-rate = 60
D/CCodec  (23025):   int32_t height = 480
D/CCodec  (23025):   int32_t i-frame-period = 6000
D/CCodec  (23025):   string mime = "video/raw"
D/CCodec  (23025):   int32_t prepend-sps-pps-to-idr-frames = 1
D/CCodec  (23025):   int32_t priority = 1
D/CCodec  (23025):   int32_t width = 720
D/CCodec  (23025):   int32_t android._dataspace = 0
D/CCodec  (23025):   int32_t color-format = 2130708361
D/CCodec  (23025): }
D/CCodec  (23025): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec  (23025):   int32_t bitrate = 300000
D/CCodec  (23025):   int32_t bitrate-mode = 2
D/CCodec  (23025):   Rect crop(0, 0, 719, 479)
D/CCodec  (23025):   int32_t color-standard = 0
D/CCodec  (23025):   int32_t color-range = 0
D/CCodec  (23025):   int32_t color-transfer = 0
D/CCodec  (23025):   int32_t frame-rate = 60
D/CCodec  (23025):   int32_t height = 480
D/CCodec  (23025):   int32_t i-frame-period = 6000
D/CCodec  (23025):   int32_t level = 1
D/CCodec  (23025):   int32_t max-bitrate = 300000
D/CCodec  (23025):   string mime = "video/x-vnd.on2.vp8"
D/CCodec  (23025):   int32_t prepend-sps-pps-to-idr-frames = 1
D/CCodec  (23025):   int32_t priority = 1
D/CCodec  (23025):   int32_t profile = 1
D/CCodec  (23025):   int32_t width = 720
D/CCodec  (23025): }
I/CCodecConfig(23025): query failed after returning 19 values (BAD_INDEX)
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
D/CCodec  (23025): input format changed to AMessage(what = 0x00000000) = {
D/CCodec  (23025):   int32_t android._color-format = 2130708361
D/CCodec  (23025):   Rect crop(0, 0, 719, 479)
D/CCodec  (23025):   int32_t color-standard = 4
D/CCodec  (23025):   int32_t color-range = 2
D/CCodec  (23025):   int32_t color-transfer = 3
D/CCodec  (23025):   int32_t frame-rate = 60
D/CCodec  (23025):   int32_t height = 480
D/CCodec  (23025):   int32_t i-frame-period = 6000
D/CCodec  (23025):   string mime = "video/raw"
D/CCodec  (23025):   int32_t prepend-sps-pps-to-idr-frames = 1
D/CCodec  (23025):   int32_t priority = 1
D/CCodec  (23025):   int32_t width = 720
D/CCodec  (23025):   int32_t android._dataspace = 259
D/CCodec  (23025):   int32_t color-format = 2130708361
D/CCodec  (23025): }
D/GraphicBufferSource(23025): setting dataspace: 0x103, acquired=0
D/CCodec  (23025): ISConfig not changed
W/Codec2Client(23025): query -- param skipped: index = 1342179345.
W/Codec2Client(23025): query -- param skipped: index = 2415921170.
W/Codec2Client(23025): query -- param skipped: index = 1610614798.
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#797] Query input allocators returned 0 params => BAD_INDEX (6)
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#797] Using basic input block pool with poolID 1 => got 1 - OK (0)
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#797] Query output allocators returned 0 params => BAD_INDEX (6)
I/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#797] Created output block pool with allocatorID 16 => poolID 4500 - OK
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#797] Configured output block pool ids 4500 => OK
I/org.webrtc.Logging(23025): HardwareVideoEncoder: Releasing MediaCodec on output thread
I/org.webrtc.Logging(23025): HardwareVideoEncoder: Release on output thread done
I/hw-BpHwBinder(23025): onLastStrongRef automatically unlinking death recipients
I/org.webrtc.Logging(23025): HardwareVideoEncoder: initEncode: 540 x 360. @ 300kbps. Fps: 60 Use surface mode: true
D/CCodec  (23025): allocate(c2.qti.vp8.encoder)
I/CCodec  (23025): setting up 'default' as default (vendor) store
I/CCodec  (23025): Created component [c2.qti.vp8.encoder]
D/CCodecConfig(23025): read media type: video/x-vnd.on2.vp8
D/ReflectedParamUpdater(23025): extent() != 1 for single value type: output.buffers.pool-ids.values
D/CCodecConfig(23025): ignoring local param raw.color (0xc2001809) as it is already supported
I/CCodecConfig(23025): query failed after returning 19 values (BAD_INDEX)
D/CCodecConfig(23025): c2 config diff is Dict {
D/CCodecConfig(23025):   c2::u32 algo.bitrate-mode.value = 3
D/CCodecConfig(23025):   c2::i32 algo.priority.value = -1
D/CCodecConfig(23025):   c2::u32 algo.quality.value = 50
D/CCodecConfig(23025):   c2::float algo.rate.value = 4.2039e-44
D/CCodecConfig(23025):   c2::u32 coded.bitrate.value = 20000000
D/CCodecConfig(23025):   c2::float coded.frame-rate.value = 30
D/CCodecConfig(23025):   c2::u32 coded.pl.level = 28672
D/CCodecConfig(23025):   c2::u32 coded.pl.profile = 28672
D/CCodecConfig(23025):   c2::u32 coded.vui.color.matrix = 0
D/CCodecConfig(23025):   c2::u32 coded.vui.color.primaries = 0
D/CCodecConfig(23025):   c2::u32 coded.vui.color.range = 0
D/CCodecConfig(23025):   c2::u32 coded.vui.color.transfer = 0
D/CCodecConfig(23025):   c2::i32 coding.gop.intra-period = 1
D/CCodecConfig(23025):   c2::u32 coding.request-sync-frame.value = 0
D/CCodecConfig(23025):   c2::u32 default.color.matrix = 0
D/CCodecConfig(23025):   c2::u32 default.color.primaries = 0
D/CCodecConfig(23025):   c2::u32 default.color.range = 0
D/CCodecConfig(23025):   c2::u32 default.color.transfer = 0
D/CCodecConfig(23025):   c2::u32 input.delay.value = 8
D/CCodecConfig(23025):   string input.media-type.value = "video/raw"
D/CCodecConfig(23025):   c2::u32 output.buffers.prepend-header.value = 2
D/CCodecConfig(23025):   c2::u32 output.delay.value = 8
D/CCodecConfig(23025):   string output.media-type.value = "video/x-vnd.on2.vp8"
D/CCodecConfig(23025):   c2::u32 raw.color.matrix = 0
D/CCodecConfig(23025):   c2::u32 raw.color.primaries = 0
D/CCodecConfig(23025):   c2::u32 raw.color.range = 0
D/CCodecConfig(23025):   c2::u3
W/ColorUtils(23025): expected specified color aspects (0:0:0:0)
I/org.webrtc.Logging(23025): HardwareVideoEncoder: Format: {color-format=2130708361, i-frame-interval=100, mime=video/x-vnd.on2.vp8, width=540, bitrate-mode=2, bitrate=300000, frame-rate=60, height=360}
D/VQApply (23025): minquality: applies only to VBR encoding
D/MediaCodec(23025): shapeMediaFormat: deltas(0): AMessage(what = 0x00000000) = {
D/MediaCodec(23025):   }
D/CCodec  (23025): [c2.qti.vp8.encoder] buffers are bound to CCodec for this session
D/CCodecConfig(23025): no c2 equivalents for color-format
D/CCodecConfig(23025): no c2 equivalents for flags
D/CCodecConfig(23025): no c2 equivalents for encoder
D/CCodecConfig(23025): c2 config diff is   c2::u32 algo.bitrate-mode.value = 1
D/CCodecConfig(23025):   c2::u32 coded.bitrate.value = 300000
D/CCodecConfig(23025):   c2::float coded.frame-rate.value = 60
D/CCodecConfig(23025):   c2::i32 coding.gop.intra-period = 6000
D/CCodecConfig(23025):   c2::u32 raw.pixel-format.value = 34
D/CCodecConfig(23025):   c2::u32 raw.size.height = 360
D/CCodecConfig(23025):   c2::u32 raw.size.width = 540
W/ColorUtils(23025): expected specified color aspects (0:0:0:0)
W/Codec2Client(23025): query -- param skipped: index = 1107298332.
W/Codec2Client(23025): query -- param skipped: index = 3254781982.
D/CCodec  (23025): setup formats input: AMessage(what = 0x00000000) = {
D/CCodec  (23025):   int32_t android._color-format = 2130708361
D/CCodec  (23025):   Rect crop(0, 0, 539, 359)
D/CCodec  (23025):   int32_t color-standard = 0
D/CCodec  (23025):   int32_t color-range = 0
D/CCodec  (23025):   int32_t color-transfer = 0
D/CCodec  (23025):   int32_t frame-rate = 60
D/CCodec  (23025):   int32_t height = 360
D/CCodec  (23025):   int32_t i-frame-period = 6000
D/CCodec  (23025):   string mime = "video/raw"
D/CCodec  (23025):   int32_t prepend-sps-pps-to-idr-frames = 1
D/CCodec  (23025):   int32_t priority = 1
D/CCodec  (23025):   int32_t width = 540
D/CCodec  (23025):   int32_t android._dataspace = 0
D/CCodec  (23025):   int32_t color-format = 2130708361
D/CCodec  (23025): }
D/CCodec  (23025): setup formats output: AMessage(what = 0x00000000) = {
D/CCodec  (23025):   int32_t bitrate = 300000
D/CCodec  (23025):   int32_t bitrate-mode = 2
D/CCodec  (23025):   Rect crop(0, 0, 539, 359)
D/CCodec  (23025):   int32_t color-standard = 0
D/CCodec  (23025):   int32_t color-range = 0
D/CCodec  (23025):   int32_t color-transfer = 0
D/CCodec  (23025):   int32_t frame-rate = 60
D/CCodec  (23025):   int32_t height = 360
D/CCodec  (23025):   int32_t i-frame-period = 6000
D/CCodec  (23025):   int32_t level = 1
D/CCodec  (23025):   int32_t max-bitrate = 300000
D/CCodec  (23025):   string mime = "video/x-vnd.on2.vp8"
D/CCodec  (23025):   int32_t prepend-sps-pps-to-idr-frames = 1
D/CCodec  (23025):   int32_t priority = 1
D/CCodec  (23025):   int32_t profile = 1
D/CCodec  (23025):   int32_t width = 540
D/CCodec  (23025): }
I/CCodecConfig(23025): query failed after returning 19 values (BAD_INDEX)
I/org.webrtc.Logging(23025): EglBase14Impl: Using OpenGL ES version 2
D/CCodec  (23025): input format changed to AMessage(what = 0x00000000) = {
D/CCodec  (23025):   int32_t android._color-format = 2130708361
D/CCodec  (23025):   Rect crop(0, 0, 539, 359)
D/CCodec  (23025):   int32_t color-standard = 2
D/CCodec  (23025):   int32_t color-range = 2
D/CCodec  (23025):   int32_t color-transfer = 3
D/CCodec  (23025):   int32_t frame-rate = 60
D/CCodec  (23025):   int32_t height = 360
D/CCodec  (23025):   int32_t i-frame-period = 6000
D/CCodec  (23025):   string mime = "video/raw"
D/CCodec  (23025):   int32_t prepend-sps-pps-to-idr-frames = 1
D/CCodec  (23025):   int32_t priority = 1
D/CCodec  (23025):   int32_t width = 540
D/CCodec  (23025):   int32_t android._dataspace = 258
D/CCodec  (23025):   int32_t color-format = 2130708361
D/CCodec  (23025): }
D/GraphicBufferSource(23025): setting dataspace: 0x102, acquired=0
D/CCodec  (23025): ISConfig not changed
W/Codec2Client(23025): query -- param skipped: index = 1342179345.
W/Codec2Client(23025): query -- param skipped: index = 2415921170.
W/Codec2Client(23025): query -- param skipped: index = 1610614798.
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#609] Query input allocators returned 0 params => BAD_INDEX (6)
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#609] Using basic input block pool with poolID 1 => got 1 - OK (0)
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#609] Query output allocators returned 0 params => BAD_INDEX (6)
I/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#609] Created output block pool with allocatorID 16 => poolID 4501 - OK
D/CCodecBufferChannel(23025): [c2.qti.vp8.encoder#609] Configured output block pool ids 4501 => OK
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 14.
I/org.webrtc.Logging(23025): EglRenderer: Duration: 4005 ms. Frames received: 58. Dropped: 0. Rendered: 58. Render fps: 14,5. Average render time: 2297 us. Average swapBuffer time: 964 us.
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 15.
I/org.webrtc.Logging(23025): EglRenderer: Duration: 4005 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: ,0. Average render time: NA. Average swapBuffer time: NA.
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 15.
I/org.webrtc.Logging(23025): EglRenderer: Duration: 4005 ms. Frames received: 60. Dropped: 0. Rendered: 60. Render fps: 15,0. Average render time: 2037 us. Average swapBuffer time: 952 us.
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 16.
I/org.webrtc.Logging(23025): EglRenderer: Duration: 4011 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: ,0. Average render time: NA. Average swapBuffer time: NA.
I/org.webrtc.Logging(23025): CameraStatistics: Camera fps: 15.
I/org.webrtc.Logging(23025): NetworkMonitorAutoDetect: capabilities changed: [ Transports: CELLULAR Capabilities: MMS&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED&NOT_VCN_MANAGED LinkUpBandwidth>=15000Kbps LinkDnBandwidth>=9968Kbps Specifier: <TelephonyNetworkSpecifier [mSubId = 2]>]

Thanks.

marcoberetta96 avatar Nov 07 '21 13:11 marcoberetta96

You need to deploy a turn server because if there is symmetric NAT between different networks, the p2p connection will be not established.

cloudwebrtc avatar Nov 07 '21 14:11 cloudwebrtc

Thanks @cloudwebrtc

I tried with this

RTCPeerConnection rtcPeerConnection = await createPeerConnection(
  {
    'iceServers': [
      {
        'url': 'turns:numb.viagenie.ca:19403',
        'username': '[email protected]',
        'credential': 'muazkh',
      },
    ],
    'iceTransportPolicy': 'relay',
    'sdpSemantics': 'uinified-plan'
  },
  {
    'mandatory': {},
    'optional': [
      {'DtlsSrtpKeyAgreement': true},
    ]
  },
);

as described in https://webrtc.org/getting-started/turn-server but it does not work. I took the TURN from https://gist.github.com/sagivo/3a4b2f2c7ac6e1b5267c2f1f59ac6c6b just to testing purposes.

How can I understand what's happening? Thanks

marcoberetta96 avatar Nov 07 '21 16:11 marcoberetta96

Same issue But flutter webrtc demo p2p wortks with wifi and 4g Magic...)

olegys avatar Nov 09 '21 20:11 olegys

@cloudwebrtc I have deployed a Coturn server on google cloud.

Testing as the below imag works because I get relay candidates, but a call between a phone connected to wifi and another phone connected to 4g cannot start yet.

What should I do or check? Thanks.

image

marcoberetta96 avatar Nov 09 '21 23:11 marcoberetta96

I tested both with a Coturn server deployed in the google cloud and with xirsys.com. A call between a phone connected to wifi and one connected to 4g doesn't work in any of the cases.

@cloudwebrtc I would like to debug the issue and help improving this package, but I need some guidance. Also, I can share (privately) the credentials to use my Coturn server or the service xirsys.com.

Just wait for your reply :)

marcoberetta96 avatar Nov 10 '21 22:11 marcoberetta96

This is one of the ICE candidate one of the phone receives

candidate:3396502552 1 udp 25108735 167.172.162.40 53168 typ relay raddr 37.163.167.64 rport 29614 generation 0 ufrag xc/V network-id 3 network-cost 900

marcoberetta96 avatar Nov 10 '21 23:11 marcoberetta96

Same issue here, any workaround?

liemfs avatar Nov 15 '21 06:11 liemfs

Thanks @cloudwebrtc

I tried with this

RTCPeerConnection rtcPeerConnection = await createPeerConnection(
  {
    'iceServers': [
      {
        'url': 'turns:numb.viagenie.ca:19403',
        'username': '[email protected]',
        'credential': 'muazkh',
      },
    ],
    'iceTransportPolicy': 'relay',
    'sdpSemantics': 'uinified-plan'
  },
  {
    'mandatory': {},
    'optional': [
      {'DtlsSrtpKeyAgreement': true},
    ]
  },
);

as described in https://webrtc.org/getting-started/turn-server but it does not work. I took the TURN from https://gist.github.com/sagivo/3a4b2f2c7ac6e1b5267c2f1f59ac6c6b just to testing purposes.

How can I understand what's happening? Thanks

Here is a good blog that can help you https://larrylisky.com/2020/05/22/implementing-flutter-webrtc-client-and-server/

I just followed it, and It solved my problem, just to change iceServers by adding my Coturn deployed server

 'iceServers': [
         {
            'url': 'turn:YOUR_TURN_SERVER_ADDRESS:3478',
            'username':YOUR_COTURN_USERNAME,
            'credential': YOUR_COTURN_PASSWORD
         },
      ] 

      

niyoceles avatar Feb 08 '22 10:02 niyoceles

@marcoberetta96 workaround? any solution?

bijoya-banik avatar Feb 10 '22 06:02 bijoya-banik

unfortunately no

marcoberetta96 avatar Feb 11 '22 11:02 marcoberetta96

Hello! Can you please tell any solution how to solve this problem? Why do we need webrtc connection at all if it works only on same network?

Deploying my own Coturn server didn't solve the problem.

Same issue, trying to find solution for several days, really need a workaround.

RobotKSR avatar Mar 12 '22 19:03 RobotKSR

Hello! Can you please tell any solution how to solve this problem? Why do we need webrtc connection at all if it works only on same network?

Deploying my own Coturn server didn't solve the problem.

Same issue, trying to find solution for several days, really need a workaround.

It's quite easy, you need to config relay in your coturn server

liemfs avatar Mar 13 '22 01:03 liemfs

@liemfs , thank you, your answer helped me! So, for any person who bumps into this problem, what helped to me:

  • install SSL certificate with certbot to my server;
  • followed this instructions to configure coturn server;
  • uncomment 'server-relay' line in /etc/turnserver.conf file
  • added 'sdpSemantics': 'unified-plan' to config object of peerConnection in flutter (maybe not needed)

And everything connected fine in a few moments after trying again.

RobotKSR avatar Mar 13 '22 09:03 RobotKSR

if you ensure: STUN/TURN servers work well ( test on Trickle ICE), the problem may be due to ICE.

because PeerConnection tends to connect the first/high priority IceCandidate. Even if you have connected to others, the peer connection keeps collecting IceCandiate, therefore if you do not handle the disconnect/failed IceConnectionState, the peer connection will close after a time because no available IceCandidate is added to this connection

Solution:

  1. let PeerConnection listen to onIceConnectionState: yourPeerConnection.onIceConnectionState = yourIceConnectionStateHandler(...)
    peerConnection.onIceConnectionState ??=
        (state) => yourIceConnectionStateHandler(state,...);
  1. in yourIceConnectionStateHandler(state, ...), run PeerConnection.restartIce() to find the next available IceCandidate.
    switch (state) {
      case RTCIceConnectionState.RTCIceConnectionStateDisconnected:
      case RTCIceConnectionState.RTCIceConnectionStateFailed:
        yourPeerConnection.restartIce();
        return;
      default:
        return;
    }

NOTE: PeerConnection keeps collecting IceCandidate, even if PeerConnectionState is connected. When peer networks become poor, the current IceCandidates used in your peer connection may not apply to both network statuses, so you should restart ICE to find another IceCandidate.

SimonWang9610 avatar Apr 27 '22 22:04 SimonWang9610

I had a scenario that is basing on my struggles for about 15 hours.

First I can successfully make worked webrtc streams between two web apps. I have my own coturn server that works in an entirely different network. I thought there wasn't a problem about my signaling server. But when I wanted to use Flutter_webrtc, streams were only transferred when my Flutter App's device connected to the internet via mobile data. And if my device connected to any Wi-Fi network the streams weren't transferring.

So I spend a lot of time searching about Flutter_webrtc. Thanks to the @RobotKSR for this answer, with adding server-relay to my /etc/turnserver.conf file everything is working fine. In the end, the issue was about my coturn configuration, not Flutter_webrtc.

Annotation

  • added 'sdpSemantics': 'unified-plan' to config object of peerConnection in flutter (maybe not needed)

When I do the above line of the @RobotKSR's answer, my app crashed. My Flutter_webrtc version is 0.8.12.

MCYBA avatar Sep 19 '22 17:09 MCYBA

@MCYBA @RobotKSR Thanks. uncomment 'server-relay' line in /etc/turnserver.conf file, which solves my problem

yw-forGit avatar Jul 02 '23 04:07 yw-forGit

i have this propelm and i put turn server and still :)

for knowledge i use vanilla javascript with webRTC API.

YousofSayed avatar Jul 05 '23 02:07 YousofSayed

@liemfs , thank you, your answer helped me! So, for any person who bumps into this problem, what helped to me:

  • install SSL certificate with certbot to my server;
  • followed this instructions to configure coturn server;
  • uncomment 'server-relay' line in /etc/turnserver.conf file
  • added 'sdpSemantics': 'unified-plan' to config object of peerConnection in flutter (maybe not needed)

And everything connected fine in a few moments after trying again.

Using this solution, the problem is solved successfully

hessonsu avatar Nov 21 '23 07:11 hessonsu