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

Commit

Permalink
Browse files Browse the repository at this point in the history
…brtc-android into incubo4u/fix-metadata-handling
  • Loading branch information
incubo4u committed Jan 10, 2024
2 parents 3a279c9 + 79d4574 commit d93ee4f
Show file tree
Hide file tree
Showing 43 changed files with 2,046 additions and 1,667 deletions.
7 changes: 5 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
[*.{kt,kts}]
ktlint_disabled_rules = no-wildcard-imports,filename
ktlint_standard_no-wildcard-imports = disbaled
ktlint_standard_filename = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_property-naming = disabled
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
ij_kotlin_packages_to_use_import_on_demand = java.util.*,kotlinx.android.synthetic.**
indent_size = 4
indent_style = space
insert_final_newline = true
ktlint_code_style = official
ktlint_code_style = ktlint_official
ktlint_ignore_back_ticked_identifier = false
ktlint_standard_no-wildcard-imports= disabled
max_line_length = 120
2 changes: 1 addition & 1 deletion .github/workflows/run_lint_and_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- uses: actions/checkout@v3

- name: Download ktlint
run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.47.1/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/
run: curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.1.1/ktlint && chmod a+x ktlint && sudo mv ktlint /usr/local/bin/

- name: Run linter
run: ktlint **/*.kt
Expand Down
415 changes: 216 additions & 199 deletions MembraneRTC/src/main/java/org/membraneframework/rtc/MembraneRTC.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package org.membraneframework.rtc

sealed class MembraneRTCError : Exception() {
data class RTC(val reason: String) : MembraneRTCError()

data class Transport(val reason: String) : MembraneRTCError()

data class Unknown(val reason: String) : MembraneRTCError()

override fun toString(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ interface MembraneRTCListener {
fun onSendMediaEvent(event: SerializedMediaEvent)

// Callback invoked when the client has been approved to participate in media exchange.
fun onConnected(endpointID: String, otherEndpoints: List<Endpoint>)
fun onConnected(
endpointID: String,
otherEndpoints: List<Endpoint>
)

// Called when endpoint of this MembraneRTC instance was removed
fun onDisconnected()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,39 @@ import org.webrtc.*
import org.webrtc.audio.AudioDeviceModule

internal class PeerConnectionFactoryWrapper
@AssistedInject constructor(
@Assisted private val createOptions: CreateOptions,
audioDeviceModule: AudioDeviceModule,
eglBase: EglBase,
appContext: Context
) {
@AssistedFactory
interface PeerConnectionFactoryWrapperFactory {
fun create(
createOptions: CreateOptions
): PeerConnectionFactoryWrapper
}
@AssistedInject
constructor(
@Assisted private val createOptions: CreateOptions,
audioDeviceModule: AudioDeviceModule,
eglBase: EglBase,
appContext: Context
) {
@AssistedFactory
interface PeerConnectionFactoryWrapperFactory {
fun create(createOptions: CreateOptions): PeerConnectionFactoryWrapper
}

val peerConnectionFactory: PeerConnectionFactory
val peerConnectionFactory: PeerConnectionFactory

init {
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions.builder(appContext).createInitializationOptions()
)
init {
PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions.builder(appContext).createInitializationOptions()
)

peerConnectionFactory =
PeerConnectionFactory.builder().setAudioDeviceModule(audioDeviceModule).setVideoEncoderFactory(
SimulcastVideoEncoderFactoryWrapper(
eglBase.eglBaseContext,
createOptions.encoderOptions
)
).setVideoDecoderFactory(DefaultVideoDecoderFactory(eglBase.eglBaseContext)).createPeerConnectionFactory()
}
peerConnectionFactory =
PeerConnectionFactory.builder().setAudioDeviceModule(audioDeviceModule).setVideoEncoderFactory(
SimulcastVideoEncoderFactoryWrapper(
eglBase.eglBaseContext,
createOptions.encoderOptions
)
).setVideoDecoderFactory(DefaultVideoDecoderFactory(eglBase.eglBaseContext))
.createPeerConnectionFactory()
}

fun createPeerConnection(
rtcConfig: PeerConnection.RTCConfiguration,
observer: PeerConnection.Observer
): PeerConnection? {
return peerConnectionFactory.createPeerConnection(rtcConfig, observer)
fun createPeerConnection(
rtcConfig: PeerConnection.RTCConfiguration,
observer: PeerConnection.Observer
): PeerConnection? {
return peerConnectionFactory.createPeerConnection(rtcConfig, observer)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import org.webrtc.IceCandidate
import org.webrtc.MediaStreamTrack

internal interface PeerConnectionListener {
fun onAddTrack(trackId: String, track: MediaStreamTrack)
fun onAddTrack(
trackId: String,
track: MediaStreamTrack
)

fun onLocalIceCandidate(candidate: IceCandidate)
}
Loading

0 comments on commit d93ee4f

Please sign in to comment.