flutter-webrtc / flutter-webrtc

WebRTC plugin for Flutter Mobile/Desktop/Web
MIT License
4.15k stars 1.13k forks source link

Webrtc camera logs event disconnect calls #1510

Open bilalgodesto opened 10 months ago

bilalgodesto commented 10 months ago

Describe the bug

In peer to peer and peer to many peers calls when i disconnect webrtc and RTCVideoRenderer are set to null and also tried disposed.I still see the webrtc logs as

Closing rtcpeerconnection


  Future<void> close() async {
    // Release the local media stream
    if (_localStream != null) {
      _localStream!.getTracks().forEach((track) {
        track.stop(); // Stop each track
      });
      await _localStream!.dispose();
      _localStream = null;
    }

    if (_remoteStreams != null) {
      _remoteStreams?.forEach((element) async {
        element.getTracks().forEach((track) {
          track.stop(); // Stop each track
        });
        await element.dispose();
      });
    }

    // Cancel subscriptions
    await hangupSub?.cancel();
    await messagesStreamSubscription?.cancel();
    repeatSendCallNotification?.cancel();

    // Close all peer connections and release their streams
    _peerConnections.forEach((key, pc) async {
      // Stop all local and remote tracks
      pc.getLocalStreams().forEach((stream) async {
        stream?.getTracks().forEach((track) async {
          await track.stop();
        });
      });
      pc.getRemoteStreams().forEach((stream) async {
        stream?.getTracks().forEach((track) async {
          await track.stop();
        });
      });
      // Close the peer connection
      await pc.close();
    });

    // Clear the peer connections map
    _peerConnections.clear();
  }

and

handup call


Future<void> _hangUp() async {

    _localRenderer.srcObject = null;
    _remoteRenderer.srcObject = null;
    // await _localRenderer.dispose();
    // await _remoteRenderer.dispose();
   // **close method above is called here**
    await _signaling.bye(); 
  }

webrtc logs

I/org.webrtc.Logging( 9631): EglRenderer: Duration: 4042 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: .0. Average render time: NA. Average swapBuffer time: NA.
I/org.webrtc.Logging( 9631): EglRenderer: Duration: 4016 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: .0. Average render time: NA. Average swapBuffer time: NA.
I/org.webrtc.Logging( 9631): EglRenderer: Duration: 4045 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: .0. Average render time: NA. Average swapBuffer time: NA.
I/org.webrtc.Logging( 9631): EglRenderer: Duration: 4039 ms. Frames received: 0. Dropped: 0. Rendered: 0. Render fps: .0. Average render time: NA. Average swapBuffer time: NA.

To Reproduce

Using latest Version and set a peer to peer call. I am using firebase for signaling.

Expected behavior

All resources for audio and video should be released and there should be no log.

Platform information

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/bilalrabbi/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/bilalrabbi/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C65 • CocoaPods version 1.14.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.85.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.80.0

[✓] Connected device (5 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 32) (emulator) • sdk gphone64 arm64 (mobile) • emulator-5556 • android-arm64 • Android 12 (API 32) (emulator) • iPhone (mobile) • 00008030-001004D80146802E • ios • iOS 17.1.1 21B91 • iPhone 15 Pro (mobile) • EE6B84E8-4092-497E-9033-9F330AC515B4 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator) • Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.129

[✓] Network resources • All expected network resources are available.

bilalgodesto commented 9 months ago

Any response for this please

ardeshir-33033 commented 5 months ago

did you find a way to fix this issue?

victortive commented 1 week ago

Looks like this has been fixed by #1692