DualEndpoint

open class DualEndpoint(mainEndpoint: IEndpointInternal, secondEndpoint: IEndpointInternal) : CombineEndpoint

An implementation of CombineEndpoint that combines two endpoints. The mainEndpoint is the only one closed and opened by this endpoint. The secondEndpoint is opened and closed by the user.

For example, you can combine a local endpoint and a remote endpoint to record and stream at the same time. In that case, the local endpoint will be the mainEndpoint and the remote endpoint will be the secondEndpoint.

Parameters

mainEndpoint

the main endpoint

secondEndpoint

the second endpoint

Constructors

Link copied to clipboard
constructor(mainEndpoint: IEndpointInternal, secondEndpoint: IEndpointInternal)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Internal map of endpoint streamId to real streamIds

Link copied to clipboard
open override val info: IEndpoint.IEndpointInfo

The union of all endpoints' IEndpoint.IEndpointInfo.

Link copied to clipboard
open override val isOpenFlow: StateFlow<Boolean>

Whether at least one endpoint is open. This is a combination of all endpoints' IEndpoint.isOpenFlow.

Link copied to clipboard
open override val metrics: Any

Throws UnsupportedOperationException because CombineEndpoint does not have metrics.

Functions

Link copied to clipboard
open override fun addStream(streamConfig: CodecConfig): Int

Registers a new stream to the IEndpointInternal.

Link copied to clipboard
open override fun addStreams(streamConfigs: List<CodecConfig>): Map<CodecConfig, Int>

Registers new streams to the IEndpointInternal.

Link copied to clipboard
open suspend override fun close()

Closes all endpoints

Link copied to clipboard

The union of all endpoints' IEndpoint.IEndpointInfo.

Gets configuration information

Link copied to clipboard
open suspend override fun open(descriptor: MediaDescriptor)

Opens the mainEndpoint.

Link copied to clipboard
suspend fun openSecond(descriptor: MediaDescriptor)

Opens the secondEndpoint.

Link copied to clipboard
open override fun release()

Releases an IEndpointInternal.

Link copied to clipboard
open suspend override fun startStream()

Starts the mainEndpoint.

Link copied to clipboard
suspend fun startStreamSecond()

Starts the secondEndpoint.

Link copied to clipboard

Opens the secondEndpoint and starts the stream.

Link copied to clipboard
open suspend override fun stopStream()

Stops all endpoints

Link copied to clipboard
open suspend override fun write(frame: Frame, streamPid: Int)

Writes frame to all opened endpoints.