-
Notifications
You must be signed in to change notification settings - Fork 55
Handle call errors #2011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Handle call errors #2011
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ coverage/ | |
| coverage_badge.svg | ||
| coverage.xml | ||
| TEST-report.* | ||
| coverage_dir/* | ||
|
|
||
| # IntelliJ related | ||
| *.iml | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -592,7 +592,6 @@ | |
| await addLocalStream(stream, SDPStreamMetadataPurpose.Screenshare); | ||
| return true; | ||
| } catch (err) { | ||
| fireCallEvent(CallStateChange.kError); | ||
| return false; | ||
| } | ||
| } else { | ||
|
|
@@ -1218,7 +1217,9 @@ | |
| } | ||
| }; | ||
| } catch (e) { | ||
| Logs().v('[VOIP] prepareMediaStream error => ${e.toString()}'); | ||
| Logs().v('[VOIP] preparePeerConnection error => ${e.toString()}'); | ||
| await _createPeerConnectionFailed(e); | ||
| rethrow; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this rethrow here?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, forgot to remove it |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -1313,16 +1314,16 @@ | |
| return await voip.delegate.mediaDevices.getUserMedia(mediaConstraints); | ||
| } catch (e) { | ||
| await _getUserMediaFailed(e); | ||
| rethrow; | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| Future<MediaStream?> _getDisplayMedia() async { | ||
| try { | ||
| return await voip.delegate.mediaDevices | ||
| .getDisplayMedia(UserMediaConstraints.screenMediaConstraints); | ||
| } catch (e) { | ||
| await _getUserMediaFailed(e); | ||
| await _getDisplayMediaFailed(e); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hm this is a bit difficult to read, I don't think |
||
| } | ||
| return null; | ||
| } | ||
|
|
@@ -1454,17 +1455,53 @@ | |
| } | ||
| } | ||
|
|
||
| Future<void> _createPeerConnectionFailed(dynamic err) async { | ||
| Logs().e('Failed to create peer connection object ${err.toString()}'); | ||
| fireCallEvent(CallStateChange.kError); | ||
| await terminate( | ||
| CallParty.kLocal, | ||
| CallErrorCode.createPeerConnectionFailed, | ||
| true, | ||
| ); | ||
| throw CallError( | ||
| CallErrorCode.createPeerConnectionFailed, | ||
| 'Failed to create peer connection object ', | ||
| err, | ||
| ); | ||
| } | ||
|
|
||
| Future<void> _getLocalOfferFailed(dynamic err) async { | ||
| Logs().e('Failed to get local offer ${err.toString()}'); | ||
| fireCallEvent(CallStateChange.kError); | ||
|
|
||
| await terminate(CallParty.kLocal, CallErrorCode.localOfferFailed, true); | ||
| throw CallError( | ||
| CallErrorCode.localOfferFailed, | ||
| 'Failed to get local offer', | ||
| err, | ||
| ); | ||
| } | ||
|
|
||
| Future<void> _getUserMediaFailed(dynamic err) async { | ||
| Logs().w('Failed to get user media - ending call ${err.toString()}'); | ||
| fireCallEvent(CallStateChange.kError); | ||
| await terminate(CallParty.kLocal, CallErrorCode.userMediaFailed, true); | ||
| throw CallError( | ||
| CallErrorCode.userMediaFailed, | ||
| 'Failed to get user media', | ||
| err, | ||
| ); | ||
| } | ||
|
|
||
| Future<void> _getDisplayMediaFailed(dynamic err) async { | ||
| Logs().w('Failed to get display media - ending call ${err.toString()}'); | ||
| fireCallEvent(CallStateChange.kError); | ||
| // We don't terminate the call here because the user might still want to stay | ||
| // on the call and try again later. | ||
| throw CallError( | ||
| CallErrorCode.displayMediaFailed, | ||
| 'Failed to get display media', | ||
| err, | ||
| ); | ||
| } | ||
|
|
||
| Future<void> onSelectAnswerReceived(String? selectedPartyId) async { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.