mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-19 18:55:05 +01:00
Rename localMediaStream to localStream
Align naming to the names used in WebRTC example code and documentation. Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
86f20dcfd3
commit
5b95b5675d
app/src/main/java/com/nextcloud/talk
@ -213,7 +213,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
private UserEntity conversationUser;
|
private UserEntity conversationUser;
|
||||||
private String conversationName;
|
private String conversationName;
|
||||||
private String callSession;
|
private String callSession;
|
||||||
private MediaStream localMediaStream;
|
private MediaStream localStream;
|
||||||
private String credentials;
|
private String credentials;
|
||||||
private List<MagicPeerConnectionWrapper> magicPeerConnectionWrapperList = new ArrayList<>();
|
private List<MagicPeerConnectionWrapper> magicPeerConnectionWrapperList = new ArrayList<>();
|
||||||
private Map<String, Participant> participantMap = new HashMap<>();
|
private Map<String, Participant> participantMap = new HashMap<>();
|
||||||
@ -408,7 +408,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
audioConstraints = new MediaConstraints();
|
audioConstraints = new MediaConstraints();
|
||||||
videoConstraints = new MediaConstraints();
|
videoConstraints = new MediaConstraints();
|
||||||
|
|
||||||
localMediaStream = peerConnectionFactory.createLocalMediaStream("NCMS");
|
localStream = peerConnectionFactory.createLocalMediaStream("NCMS");
|
||||||
|
|
||||||
// Create and audio manager that will take care of audio routing,
|
// Create and audio manager that will take care of audio routing,
|
||||||
// audio modes, audio device enumeration etc.
|
// audio modes, audio device enumeration etc.
|
||||||
@ -781,7 +781,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
videoCapturer.initialize(surfaceTextureHelper, getApplicationContext(), videoSource.getCapturerObserver());
|
videoCapturer.initialize(surfaceTextureHelper, getApplicationContext(), videoSource.getCapturerObserver());
|
||||||
}
|
}
|
||||||
localVideoTrack = peerConnectionFactory.createVideoTrack("NCv0", videoSource);
|
localVideoTrack = peerConnectionFactory.createVideoTrack("NCv0", videoSource);
|
||||||
localMediaStream.addTrack(localVideoTrack);
|
localStream.addTrack(localVideoTrack);
|
||||||
localVideoTrack.setEnabled(false);
|
localVideoTrack.setEnabled(false);
|
||||||
localVideoTrack.addSink(binding.selfVideoRenderer);
|
localVideoTrack.addSink(binding.selfVideoRenderer);
|
||||||
}
|
}
|
||||||
@ -791,7 +791,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
audioSource = peerConnectionFactory.createAudioSource(audioConstraints);
|
audioSource = peerConnectionFactory.createAudioSource(audioConstraints);
|
||||||
localAudioTrack = peerConnectionFactory.createAudioTrack("NCa0", audioSource);
|
localAudioTrack = peerConnectionFactory.createAudioTrack("NCa0", audioSource);
|
||||||
localAudioTrack.setEnabled(false);
|
localAudioTrack.setEnabled(false);
|
||||||
localMediaStream.addTrack(localAudioTrack);
|
localStream.addTrack(localAudioTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private VideoCapturer createCameraCapturer(CameraEnumerator enumerator) {
|
private VideoCapturer createCameraCapturer(CameraEnumerator enumerator) {
|
||||||
@ -963,8 +963,8 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localMediaStream != null && localMediaStream.videoTracks.size() > 0) {
|
if (localStream != null && localStream.videoTracks.size() > 0) {
|
||||||
localMediaStream.videoTracks.get(0).setEnabled(enable);
|
localStream.videoTracks.get(0).setEnabled(enable);
|
||||||
}
|
}
|
||||||
if (enable) {
|
if (enable) {
|
||||||
binding.selfVideoRenderer.setVisibility(View.VISIBLE);
|
binding.selfVideoRenderer.setVisibility(View.VISIBLE);
|
||||||
@ -980,8 +980,8 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
binding.microphoneButton.setAlpha(0.7f);
|
binding.microphoneButton.setAlpha(0.7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localMediaStream != null && localMediaStream.audioTracks.size() > 0) {
|
if (localStream != null && localStream.audioTracks.size() > 0) {
|
||||||
localMediaStream.audioTracks.get(0).setEnabled(enable);
|
localStream.audioTracks.get(0).setEnabled(enable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1608,12 +1608,12 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
peerConnectionFactory = null;
|
peerConnectionFactory = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(localMediaStream != null) {
|
if(localStream != null) {
|
||||||
localMediaStream.dispose();
|
localStream.dispose();
|
||||||
localMediaStream = null;
|
localStream = null;
|
||||||
Log.d(TAG, "Disposed localMediaStream");
|
Log.d(TAG, "Disposed localStream");
|
||||||
} else {
|
} else {
|
||||||
Log.d(TAG, "localMediaStream is null");
|
Log.d(TAG, "localStream is null");
|
||||||
}
|
}
|
||||||
localAudioTrack = null;
|
localAudioTrack = null;
|
||||||
localVideoTrack = null;
|
localVideoTrack = null;
|
||||||
@ -1807,7 +1807,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
sdpConstraintsForMCU,
|
sdpConstraintsForMCU,
|
||||||
sessionId,
|
sessionId,
|
||||||
callSession,
|
callSession,
|
||||||
localMediaStream,
|
localStream,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
type);
|
type);
|
||||||
@ -1829,7 +1829,7 @@ public class CallActivity extends CallBaseActivity {
|
|||||||
sdpConstraints,
|
sdpConstraints,
|
||||||
sessionId,
|
sessionId,
|
||||||
callSession,
|
callSession,
|
||||||
localMediaStream,
|
localStream,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
type);
|
type);
|
||||||
|
@ -81,7 +81,7 @@ public class MagicPeerConnectionWrapper {
|
|||||||
|
|
||||||
private boolean hasInitiated;
|
private boolean hasInitiated;
|
||||||
|
|
||||||
private MediaStream localMediaStream;
|
private MediaStream localStream;
|
||||||
private boolean isMCUPublisher;
|
private boolean isMCUPublisher;
|
||||||
private boolean hasMCU;
|
private boolean hasMCU;
|
||||||
private String videoStreamType;
|
private String videoStreamType;
|
||||||
@ -95,12 +95,12 @@ public class MagicPeerConnectionWrapper {
|
|||||||
public MagicPeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory,
|
public MagicPeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory,
|
||||||
List<PeerConnection.IceServer> iceServerList,
|
List<PeerConnection.IceServer> iceServerList,
|
||||||
MediaConstraints sdpConstraints,
|
MediaConstraints sdpConstraints,
|
||||||
String sessionId, String localSession, @Nullable MediaStream mediaStream,
|
String sessionId, String localSession, @Nullable MediaStream localStream,
|
||||||
boolean isMCUPublisher, boolean hasMCU, String videoStreamType) {
|
boolean isMCUPublisher, boolean hasMCU, String videoStreamType) {
|
||||||
|
|
||||||
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
NextcloudTalkApplication.Companion.getSharedApplication().getComponentApplication().inject(this);
|
||||||
|
|
||||||
this.localMediaStream = mediaStream;
|
this.localStream = localStream;
|
||||||
this.videoStreamType = videoStreamType;
|
this.videoStreamType = videoStreamType;
|
||||||
this.hasMCU = hasMCU;
|
this.hasMCU = hasMCU;
|
||||||
|
|
||||||
@ -116,13 +116,13 @@ public class MagicPeerConnectionWrapper {
|
|||||||
peerConnection = peerConnectionFactory.createPeerConnection(configuration, new MagicPeerConnectionObserver());
|
peerConnection = peerConnectionFactory.createPeerConnection(configuration, new MagicPeerConnectionObserver());
|
||||||
|
|
||||||
if (peerConnection != null) {
|
if (peerConnection != null) {
|
||||||
if (localStream != null) {
|
if (this.localStream != null) {
|
||||||
List<String> localMediaStreamIds = Collections.singletonList(localMediaStream.getId());
|
List<String> localStreamIds = Collections.singletonList(this.localStream.getId());
|
||||||
for(AudioTrack track : localMediaStream.audioTracks) {
|
for(AudioTrack track : this.localStream.audioTracks) {
|
||||||
peerConnection.addTrack(track, localMediaStreamIds);
|
peerConnection.addTrack(track, localStreamIds);
|
||||||
}
|
}
|
||||||
for(VideoTrack track : localStream.videoTracks) {
|
for(VideoTrack track : this.localStream.videoTracks) {
|
||||||
peerConnection.addTrack(track, localMediaStreamIds);
|
peerConnection.addTrack(track, localStreamIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,14 +240,14 @@ public class MagicPeerConnectionWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendInitialMediaStatus() {
|
private void sendInitialMediaStatus() {
|
||||||
if (localMediaStream != null) {
|
if (localStream != null) {
|
||||||
if (localMediaStream.videoTracks.size() == 1 && localMediaStream.videoTracks.get(0).enabled()) {
|
if (localStream.videoTracks.size() == 1 && localStream.videoTracks.get(0).enabled()) {
|
||||||
sendChannelData(new DataChannelMessage("videoOn"));
|
sendChannelData(new DataChannelMessage("videoOn"));
|
||||||
} else {
|
} else {
|
||||||
sendChannelData(new DataChannelMessage("videoOff"));
|
sendChannelData(new DataChannelMessage("videoOff"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localMediaStream.audioTracks.size() == 1 && localMediaStream.audioTracks.get(0).enabled()) {
|
if (localStream.audioTracks.size() == 1 && localStream.audioTracks.get(0).enabled()) {
|
||||||
sendChannelData(new DataChannelMessage("audioOn"));
|
sendChannelData(new DataChannelMessage("audioOn"));
|
||||||
} else {
|
} else {
|
||||||
sendChannelData(new DataChannelMessage("audioOff"));
|
sendChannelData(new DataChannelMessage("audioOff"));
|
||||||
|
Loading…
Reference in New Issue
Block a user