Comments (8)
Thanks for getting to the bottom of it. By the looks it seems like a revert is the most sensible thing to do, while the investigation for the original issue continues.
from react-native-webrtc.
This is the only piece of code that deals with remoteTracks
in the onAddTrack
handler on Android (same on iOS FWIW):
// We need to fire this event for an existing track sometimes, like
// when the transceiver direction (on the sending side) switches from
// sendrecv to recvonly and then back.
final boolean existingTrack = remoteTracks.containsKey(track.id());
if (!existingTrack) {
if (track.kind().equals(MediaStreamTrack.VIDEO_TRACK_KIND)) {
videoTrackAdapters.addAdapter((VideoTrack) track);
}
remoteTracks.put(track.id(), track);
}
The change was made by yours truly in 6df8357
Ssomething that just came to mind is that now we are removing the remote track from our map, but we are not disposing its adapter, in case it's a video track.
Turning this the other way around, @davidliu what problem were you fixing? AFAIS there is no way for track
to not be set for a receiver: https://w3c.github.io/webrtc-pc/ So it feels like what we merged was more incorrect, generally speaking.
from react-native-webrtc.
Looking at the example code, this is caused by how it's ordered in the mediasoup library.
Consumer.pause()
:
track.enabled
is set to falseonRemoveTrack
gets called- Notably, the track is not removed from
Consumer
.
- Notably, the track is not removed from
Consumer.resume()
track.enabled
is set to true- Since the track is removed from our map, this call fails.
onAddTrack
gets called after.
Not sure how MediaStreamTrack lifetimes are supposed to work, but I'm guessing it actually does stay alive in some form for browsers even after removal, which allows for this wonky call order.
@saghul I'll reinvestigate the original issue and get back to you.
from react-native-webrtc.
What does Consumer.pause
do under the hood? Change the transceiver direction?
from react-native-webrtc.
Sets the direction to inactive
for the transceiver as well as the media object in the sdp (and then renegotiates).
from react-native-webrtc.
In that case I think the track won't disappear, if we inspect that receiver.
from react-native-webrtc.
Yeah, checked it and the receiver still has the track in this case.
For my original issue, the sender unpublished and republished an audio track with the same track id. In some instances, the setVolume call failed (unfortunately I wasn't able to personally repro it). The intention of the original PR was actually to refresh the cached remote track pointer reference to a new one when it came back in onAddTrack, and seemed to fix the issue.
from react-native-webrtc.
Thank you very much for all the work!
from react-native-webrtc.
Related Issues (20)
- RN 0.73+ compatibility issue: "Property 'addEventListener' does not exist on type 'RTCPeerConnection'" HOT 10
- Simulcasting not working on iOS in react-native-webrtc HOT 20
- Unable to set remote description after call accepted from remote side HOT 6
- Get Raw Audio from reat-native-webrtc tracks. HOT 7
- Crash occurred during webrtc connection HOT 21
- voice breaking when in speaker mode in android 9 HOT 6
- What is expected time for the support of webrtc in macOS HOT 6
- React Native WebRTC randomly crashes if audio track is enabled HOT 2
- New Architecture - Considerations/Discussion HOT 2
- ios: Needs privacy manifest for WebRTC framework HOT 4
- ios: mediaDevices.enumerateDevices() only returns wide angle camera as environment facing capture device
- Unble to render screen share (track) through RTCView HOT 2
- App crashes on Android 6.0.1 (sdk 23) java.lang.NoClassDefFoundError HOT 5
- Crash in libjingle when dialing outbound audio call HOT 11
- Expo 51 event-target-shim/package.json Package subpath './index' is not defined HOT 3
- I can't get the other user audio level in react native. HOT 1
- org.webrtc.AndroidVideoDecoder.copyI420Buffer HOT 1
- Black screen problem when calling via specific operator HOT 12
- Pod install Error after installing react-native-webrtc HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-webrtc.