Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
karkakol committed Jun 10, 2024
1 parent 0cbd096 commit b27d60f
Showing 1 changed file with 51 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ internal class InternalMembraneRTC(

fun disconnect() {
Log.i(T, "disconnect")
Log.i(T,"")
coroutineScope.launch {
rtcEngineCommunication.disconnect()
localTracksMutex.withLock {
Expand All @@ -97,11 +98,14 @@ internal class InternalMembraneRTC(

fun receiveMediaEvent(event: SerializedMediaEvent) {
Log.i(T, "receiveMediaEvent")
Log.i(T, event)
Log.i(T,"")
rtcEngineCommunication.onEvent(event)
}

fun connect(endpointMetadata: Metadata? = mapOf()) {
Log.i(T, "connect")
Log.i(T,"")

coroutineScope.launch {
// localMicrophoneMutex.lock()
Expand All @@ -118,7 +122,7 @@ internal class InternalMembraneRTC(
captureDeviceName: String? = null
): LocalVideoTrack {
Log.i(T, "createLocalVideoTrack")

Log.i(T,"")
val videoTrack =
LocalVideoTrack.create(
context,
Expand All @@ -131,6 +135,10 @@ internal class InternalMembraneRTC(
}

localTracks.add(videoTrack)
Log.i(T, "Local tracks")
Log.i(T, localTracks.toString())
Log.i(T,"")

localEndpoint = localEndpoint.withTrack(videoTrack.id(), metadata)

coroutineScope.launch {
Expand All @@ -144,6 +152,7 @@ internal class InternalMembraneRTC(

fun createLocalAudioTrack(metadata: Metadata = mapOf()): LocalAudioTrack {
Log.i(T, "createLocalAudioTrack")
Log.i(T,"")

val audioTrack =
LocalAudioTrack.create(
Expand All @@ -154,6 +163,10 @@ internal class InternalMembraneRTC(
}

localTracks.add(audioTrack)
Log.i(T, "local tracks")
Log.i(T, localTracks.toString())
Log.i(T,"")

localEndpoint = localEndpoint.withTrack(audioTrack.id(), metadata)

coroutineScope.launch {
Expand All @@ -170,6 +183,8 @@ internal class InternalMembraneRTC(
bandwidthLimit: TrackBandwidthLimit.BandwidthLimit
) {
Log.i(T, "setTrackBandwidth")
Log.i(T, bandwidthLimit.toString())
Log.i(T,"")

coroutineScope.launch {
peerConnectionManager.setTrackBandwidth(trackId, bandwidthLimit)
Expand All @@ -182,6 +197,8 @@ internal class InternalMembraneRTC(
bandwidthLimit: TrackBandwidthLimit.BandwidthLimit
) {
Log.i(T, "setEncodingBandwidth")
Log.i(T, encoding + " "+ bandwidthLimit.toString())
Log.i(T,"")

coroutineScope.launch {
peerConnectionManager.setEncodingBandwidth(trackId, encoding, bandwidthLimit)
Expand All @@ -195,6 +212,7 @@ internal class InternalMembraneRTC(
onEnd: (() -> Unit)?
): LocalScreencastTrack {
Log.i(T, "createScreencastTrack")
Log.i(T,"")

val screencastTrack =
LocalScreencastTrack.create(
Expand All @@ -210,6 +228,9 @@ internal class InternalMembraneRTC(
}

localTracks.add(screencastTrack)
Log.i(T, "local tracks")
Log.i(T, localTracks.toString())
Log.i(T,"")
localEndpoint = localEndpoint.withTrack(screencastTrack.id(), metadata)

coroutineScope.launch {
Expand All @@ -228,6 +249,7 @@ internal class InternalMembraneRTC(

fun removeTrack(trackId: String): Boolean {
Log.i(T, "removeTrack")
Log.i(T,"")

return runBlocking(Dispatchers.Default) {
localTracksMutex.withLock {
Expand All @@ -240,6 +262,9 @@ internal class InternalMembraneRTC(
peerConnectionManager.removeTrack(track.id())

localTracks.remove(track)
Log.i(T, "local tracks")
Log.i(T, localTracks.toString())
Log.i(T,"")
localEndpoint = localEndpoint.withoutTrack(trackId)
track.stop()
}
Expand All @@ -250,6 +275,8 @@ internal class InternalMembraneRTC(

fun updateEndpointMetadata(endpointMetadata: Metadata) {
Log.i(T, "updateEndpointMetadata")
Log.i(T, endpointMetadata.toString())
Log.i(T,"")

coroutineScope.launch {
rtcEngineCommunication.updateEndpointMetadata(endpointMetadata)
Expand All @@ -262,6 +289,8 @@ internal class InternalMembraneRTC(
trackMetadata: Metadata
) {
Log.i(T, "updateTrackMetadata")
Log.i(T, trackMetadata.toString())
Log.i(T,"")

// val mutex = getMutexForTrack(trackId)
coroutineScope.launch {
Expand All @@ -277,6 +306,7 @@ internal class InternalMembraneRTC(
otherEndpoints: List<Endpoint>
) {
Log.i(T, "onConnected")
Log.i(T,"")

this.localEndpoint = localEndpoint.copy(id = endpointID)
listener.onConnected(endpointID, otherEndpoints)
Expand All @@ -303,12 +333,15 @@ internal class InternalMembraneRTC(

override fun onSendMediaEvent(event: SerializedMediaEvent) {
Log.i(T, "onSendMediaEvent")
Log.i(T, event)
Log.i(T,"")

listener.onSendMediaEvent(event)
}

override fun onEndpointAdded(endpoint: Endpoint) {
Log.i(T, "onEndpointAdded")
Log.i(T,"")

if (endpoint.id == this.localEndpoint.id) {
return
Expand Down Expand Up @@ -348,6 +381,7 @@ internal class InternalMembraneRTC(
endpointMetadata: Metadata?
) {
Log.i(T, "onEndpointUpdated")
Log.i(T,"")

val endpoint =
remoteEndpoints.remove(endpointId) ?: run {
Expand All @@ -363,6 +397,7 @@ internal class InternalMembraneRTC(
tracksTypes: Map<String, Int>
) {
Log.i(T, "onOfferData")
Log.i(T,"")

coroutineScope.launch {
try {
Expand All @@ -387,6 +422,9 @@ internal class InternalMembraneRTC(
midToTrackId: Map<String, String>
) {
Log.i(T, "onSdpAnswer")
Log.i(T, type + " " + sdp)
Log.i(T,"")


coroutineScope.launch {
peerConnectionManager.onSdpAnswer(sdp, midToTrackId)
Expand Down Expand Up @@ -420,6 +458,7 @@ internal class InternalMembraneRTC(
sdpMid: String?
) {
Log.i(T, "onRemoteCandidate")
Log.i(T,"")

coroutineScope.launch {
val iceCandidate =
Expand All @@ -438,6 +477,7 @@ internal class InternalMembraneRTC(
tracks: Map<String, TrackData>
) {
Log.i(T, "onTracksAdded")
Log.i(T,"")

if (localEndpoint.id == endpointId) return

Expand Down Expand Up @@ -472,6 +512,7 @@ internal class InternalMembraneRTC(
trackIds: List<String>
) {
Log.i(T, "onTracksRemoved")
Log.i(T,"")

val endpoint =
remoteEndpoints[endpointId] ?: run {
Expand Down Expand Up @@ -499,6 +540,7 @@ internal class InternalMembraneRTC(
metadata: Metadata?
) {
Log.i(T, "onTrackUpdated")
Log.i(T,"")

val endpoint =
remoteEndpoints[endpointId] ?: run {
Expand Down Expand Up @@ -531,6 +573,7 @@ internal class InternalMembraneRTC(
encodingReason: String
) {
Log.i(T, "onTrackEncodingChanged")
Log.i(T,"")

val encodingReasonEnum = EncodingReason.fromString(encodingReason)
if (encodingReasonEnum == null) {
Expand All @@ -555,6 +598,7 @@ internal class InternalMembraneRTC(
status: String
) {
Log.i(T, "onVadNotification")
Log.i(T,"")

val trackContext = trackContexts[trackId]
if (trackContext == null) {
Expand All @@ -571,6 +615,7 @@ internal class InternalMembraneRTC(

override fun onBandwidthEstimation(estimation: Long) {
Log.i(T, "onBandwidthEstimation")
Log.i(T,"")

listener.onBandwidthEstimationChanged(estimation)
}
Expand All @@ -580,6 +625,7 @@ internal class InternalMembraneRTC(
encoding: TrackEncoding
) {
Log.i(T, "setTargetTrackEncoding")
Log.i(T,"")

coroutineScope.launch {
rtcEngineCommunication.setTargetTrackEncoding(trackId, encoding)
Expand All @@ -602,6 +648,7 @@ internal class InternalMembraneRTC(
encoding: TrackEncoding
) {
Log.i(T, "disableTrackEncoding")
Log.i(T,"")

coroutineScope.launch {
peerConnectionManager.setTrackEncoding(trackId, encoding, false)
Expand All @@ -610,6 +657,7 @@ internal class InternalMembraneRTC(

override fun onLocalIceCandidate(candidate: IceCandidate) {
Log.i(T, "onLocalIceCandidate")
Log.i(T,"")

coroutineScope.launch {
rtcEngineCommunication.localCandidate(candidate.sdp, candidate.sdpMLineIndex)
Expand All @@ -621,6 +669,7 @@ internal class InternalMembraneRTC(
track: MediaStreamTrack
) {
Log.i(T, "onAddTrack")
Log.i(T,"")

val trackContext =
trackContexts[trackId] ?: run {
Expand All @@ -644,6 +693,7 @@ internal class InternalMembraneRTC(

fun getStats(): Map<String, RTCStats> {
Log.i(T, "getStats")
Log.i(T,"")

return peerConnectionManager.getStats()
}
Expand Down

0 comments on commit b27d60f

Please sign in to comment.