Skip to content

Commit

Permalink
fix(srt): review deprecated API for SRT
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Dec 26, 2023
1 parent 96f777e commit 28fc611
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,33 @@ class SrtProducer(
/**
* Get/set SRT stream ID
*/
@Deprecated("Use SrtConnectionDescriptor.streamId instead")
var streamId: String
get() = socket.getSockFlag(SockOpt.STREAMID) as String
@Deprecated("Use SrtConnectionDescriptor.streamId instead")
set(value) = socket.setSockFlag(SockOpt.STREAMID, value)

/**
* Get/set SRT stream passPhrase
* It is a set only parameter, so getting the value throws an exception.
*/
@Deprecated("Use SrtConnectionDescriptor.passPhrase instead")
var passPhrase: String
get() = socket.getSockFlag(SockOpt.PASSPHRASE) as String
@Deprecated("Use SrtConnectionDescriptor.passPhrase instead")
set(value) = socket.setSockFlag(SockOpt.PASSPHRASE, value)

/**
* Get/set bidirectional latency in milliseconds
*/
var latency: Int
get() = socket.getSockFlag(SockOpt.LATENCY) as Int
internal set(value) = socket.setSockFlag(SockOpt.LATENCY, value)
private set(value) = socket.setSockFlag(SockOpt.LATENCY, value)

/**
* Get/set connection timeout in milliseconds
*/
var connectionTimeout: Int
get() = socket.getSockFlag(SockOpt.CONNTIMEO) as Int
internal set(value) = socket.setSockFlag(SockOpt.CONNTIMEO, value)
private set(value) = socket.setSockFlag(SockOpt.CONNTIMEO, value)

/**
* Get SRT stats
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ class AudioOnlySrtLiveStreamer(
/**
* @param value stream ID
*/
@Deprecated(
"Use the new connect(SrtConnectionDescriptor) method",
replaceWith = ReplaceWith("connect(SrtConnectionDescriptor)")
)
set(value) {
srtProducer.streamId = value
}
Expand All @@ -80,6 +84,10 @@ class AudioOnlySrtLiveStreamer(
/**
* @param value passphrase
*/
@Deprecated(
"Use the new connect(SrtConnectionDescriptor) method",
replaceWith = ReplaceWith("connect(SrtConnectionDescriptor)")
)
set(value) {
srtProducer.passPhrase = value
}
Expand All @@ -88,18 +96,12 @@ class AudioOnlySrtLiveStreamer(
* Get/set bidirectional latency in milliseconds.
* **See:** [SRT Socket Options](https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#SRTO_LATENCY)
*/
override var latency: Int
override val latency: Int
/**
* Get latency in milliseconds
* @return latency
*/
get() = srtProducer.latency
/**
* @param value latency in milliseconds
*/
set(value) {
srtProducer.latency = value
}

/**
* Connect to an SRT server with correct Live streaming parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ class CameraSrtLiveStreamer(
/**
* @param value stream ID
*/
@Deprecated(
"Use the new connect(SrtConnectionDescriptor) method",
replaceWith = ReplaceWith("connect(SrtConnectionDescriptor)")
)
set(value) {
srtProducer.streamId = value
}
Expand All @@ -112,6 +116,10 @@ class CameraSrtLiveStreamer(
/**
* @param value passphrase
*/
@Deprecated(
"Use the new connect(SrtConnectionDescriptor) method",
replaceWith = ReplaceWith("connect(SrtConnectionDescriptor)")
)
set(value) {
srtProducer.passPhrase = value
}
Expand All @@ -120,18 +128,12 @@ class CameraSrtLiveStreamer(
* Get/set bidirectional latency in milliseconds.
* **See:** [SRT Socket Options](https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#SRTO_LATENCY)
*/
override var latency: Int
override val latency: Int
/**
* Get latency in milliseconds
* @return latency
*/
get() = srtProducer.latency
/**
* @param value latency in milliseconds
*/
set(value) {
srtProducer.latency = value
}

/**
* Connect to an SRT server with correct Live streaming parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class ScreenRecorderSrtLiveStreamer(
/**
* @param value stream ID
*/
@Deprecated(
"Use the new connect(SrtConnectionDescriptor) method",
replaceWith = ReplaceWith("connect(SrtConnectionDescriptor)")
)
set(value) {
srtProducer.streamId = value
}
Expand All @@ -118,6 +122,10 @@ class ScreenRecorderSrtLiveStreamer(
/**
* @param value passphrase
*/
@Deprecated(
"Use the new connect(SrtConnectionDescriptor) method",
replaceWith = ReplaceWith("connect(SrtConnectionDescriptor)")
)
set(value) {
srtProducer.passPhrase = value
}
Expand All @@ -126,18 +134,12 @@ class ScreenRecorderSrtLiveStreamer(
* Get/set bidirectional latency in milliseconds.
* **See:** [SRT Socket Options](https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#SRTO_LATENCY)
*/
override var latency: Int
override val latency: Int
/**
* Get latency in milliseconds
* @return latency
*/
get() = srtProducer.latency
/**
* @param value latency in milliseconds
*/
set(value) {
srtProducer.latency = value
}

/**
* Connect to an SRT server with correct Live streaming parameters.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface ISrtLiveStreamer : ILiveStreamer {
/**
* Get/set bidirectional latency in milliseconds.
*/
var latency: Int
val latency: Int

/**
* Connect to a remote server.
Expand Down

0 comments on commit 28fc611

Please sign in to comment.