use onAddTrack instead of deprecated onAddStream

This commit is contained in:
Daniel Gultsch 2021-05-03 13:06:42 +02:00
parent 0717f9ba18
commit 6d91551f59
1 changed files with 2 additions and 10 deletions

View File

@ -136,13 +136,6 @@ public class WebRTCWrapper {
@Override @Override
public void onAddStream(MediaStream mediaStream) { public void onAddStream(MediaStream mediaStream) {
Log.d(EXTENDED_LOGGING_TAG, "onAddStream(numAudioTracks=" + mediaStream.audioTracks.size() + ",numVideoTracks=" + mediaStream.videoTracks.size() + ")"); Log.d(EXTENDED_LOGGING_TAG, "onAddStream(numAudioTracks=" + mediaStream.audioTracks.size() + ",numVideoTracks=" + mediaStream.videoTracks.size() + ")");
final List<VideoTrack> videoTracks = mediaStream.videoTracks;
if (videoTracks.size() > 0) {
remoteVideoTrack = videoTracks.get(0);
Log.d(Config.LOGTAG, "remote video track enabled?=" + remoteVideoTrack.enabled());
} else {
Log.d(Config.LOGTAG, "no remote video tracks found");
}
} }
@Override @Override
@ -164,10 +157,9 @@ public class WebRTCWrapper {
public void onAddTrack(RtpReceiver rtpReceiver, MediaStream[] mediaStreams) { public void onAddTrack(RtpReceiver rtpReceiver, MediaStream[] mediaStreams) {
final MediaStreamTrack track = rtpReceiver.track(); final MediaStreamTrack track = rtpReceiver.track();
Log.d(EXTENDED_LOGGING_TAG, "onAddTrack(kind=" + (track == null ? "null" : track.kind()) + ",numMediaStreams=" + mediaStreams.length + ")"); Log.d(EXTENDED_LOGGING_TAG, "onAddTrack(kind=" + (track == null ? "null" : track.kind()) + ",numMediaStreams=" + mediaStreams.length + ")");
if (track != null) { if (track instanceof VideoTrack) {
Log.d(EXTENDED_LOGGING_TAG,"onAddTrack(class="+track.getClass().getName()+")"); remoteVideoTrack = (VideoTrack) track;
} }
} }
@Override @Override