flutterjanus/flutter_janus_client

[Linux] Error when disposing VideoRoomPlugin

Opened this issue · 2 comments

When running the janus_client example in the ubuntu 23.04 operating system, we get errors when completing the call.
Library version 2.3.2

List of errors:

  • Error during execution of the command await videoPlugin?.hangup();:

    [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(MediaStreamDisposeFailed, stream [98C2C75D-0C4D-48F5-8387-67A667C09A62] not found!, null, null)
    #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
    #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
    <asynchronous suspension>
    #2      MediaStreamNative.dispose (package:flutter_webrtc/src/native/media_stream_impl.dart:93:5)
    <asynchronous suspension>
  • Error during execution of the command await videoPlugin?.dispose();:

    [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(MediaStreamDisposeFailed, stream [98C2C75D-0C4D-48F5-8387-67A667C09A62] not found!, null, null)
    #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
    #1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
    <asynchronous suspension>
    #2      MediaStreamNative.dispose (package:flutter_webrtc/src/native/media_stream_impl.dart:93:5)
    <asynchronous suspension>
    #3      stopAllTracksAndDispose (package:janus_client/utils.dart:211:3)
    <asynchronous suspension>
    #4      JanusPlugin.dispose (package:janus_client/janus_plugin.dart:348:5)
    <asynchronous suspension>
    #5      _VideoRoomState.callEnd (package:janus_client_example/typed_examples/google_meet.dart:487:5)
    <asynchronous suspension>
    #6      _VideoRoomState.build.<anonymous closure> (package:janus_client_example/typed_examples/google_meet.dart:591:21)
    <asynchronous suspension>

There was no problem when running in Chrome or Android.

please test the latest commit i think it is caused because we were stopping individual tracks of stream before disposing but in latest flutter_webrtc changes they implicitly dispose tracks inside media stream, regardless of that let me know if the latest commit works for you or not

I checked the last commit and the error persists on Linux OS.

Here are the logs:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(MediaStreamDisposeFailed, stream [87F361B8-7EBF-4D11-BE9C-0AE51A2C1A80] not found!, null, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      MediaStreamNative.dispose (package:flutter_webrtc/src/native/media_stream_impl.dart:93:5)
<asynchronous suspension>
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(MediaStreamDisposeFailed, stream [87F361B8-7EBF-4D11-BE9C-0AE51A2C1A80] not found!, null, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      MediaStreamNative.dispose (package:flutter_webrtc/src/native/media_stream_impl.dart:93:5)
<asynchronous suspension>
#3      stopAllTracksAndDispose (package:janus_client/utils.dart:208:3)
<asynchronous suspension>
#4      JanusPlugin.dispose (package:janus_client/janus_plugin.dart:348:5)
<asynchronous suspension>
#5      _VideoRoomState.callEnd (package:janus_client_example/typed_examples/google_meet.dart:487:5)
<asynchronous suspension>
#6      _VideoRoomState.build.<anonymous closure> (package:janus_client_example/typed_examples/google_meet.dart:591:21)
<asynchronous suspension>

Even after disabling the await stream?.dispose(); the error remains that the stream was not found

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(MediaStreamDisposeFailed, stream [F714BB62-C9FE-4B9F-B783-E06582A58C7D] not found!, null, null)
#0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652:7)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310:18)
<asynchronous suspension>
#2      MediaStreamNative.dispose (package:flutter_webrtc/src/native/media_stream_impl.dart:93:5)
<asynchronous suspension>
#3      JanusPlugin.dispose (package:janus_client/janus_plugin.dart:354:5)
<asynchronous suspension>
#4      _VideoRoomState.callEnd (package:janus_client_example/typed_examples/google_meet.dart:487:5)
<asynchronous suspension>
#5      _VideoRoomState.build.<anonymous closure> (package:janus_client_example/typed_examples/google_meet.dart:591:21)
<asynchronous suspension>