Skip to content

Commit

Permalink
Merge pull request #1308 from pedroSG94/feature/add-streamclient-methods
Browse files Browse the repository at this point in the history
add getItemsInCache and expose setOnlyAudio/setOnlyVideo
  • Loading branch information
pedroSG94 committed Oct 20, 2023
2 parents caeb371 + da87410 commit 107970a
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class RtmpStreamClient(

override fun getCacheSize(): Int = rtmpClient.cacheSize

override fun getItemsInCache(): Int = rtmpClient.getItemsInCache()

override fun getSentAudioFrames(): Long = rtmpClient.sentAudioFrames

override fun getSentVideoFrames(): Long = rtmpClient.sentVideoFrames
Expand All @@ -102,4 +104,12 @@ class RtmpStreamClient(
override fun resetDroppedVideoFrames() {
rtmpClient.resetDroppedVideoFrames()
}

override fun setOnlyAudio(onlyAudio: Boolean) {
rtmpClient.setOnlyAudio(onlyAudio)
}

override fun setOnlyVideo(onlyVideo: Boolean) {
rtmpClient.setOnlyVideo(onlyVideo)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class RtspStreamClient(

override fun getCacheSize(): Int = rtspClient.cacheSize

override fun getItemsInCache(): Int = rtspClient.getItemsInCache()

override fun getSentAudioFrames(): Long = rtspClient.sentAudioFrames

override fun getSentVideoFrames(): Long = rtspClient.sentVideoFrames
Expand All @@ -78,4 +80,12 @@ class RtspStreamClient(
override fun resetDroppedVideoFrames() {
rtspClient.resetDroppedVideoFrames()
}

override fun setOnlyAudio(onlyAudio: Boolean) {
rtspClient.setOnlyAudio(onlyAudio)
}

override fun setOnlyVideo(onlyVideo: Boolean) {
rtspClient.setOnlyVideo(onlyVideo)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class SrtStreamClient(

override fun getCacheSize(): Int = srtClient.cacheSize

override fun getItemsInCache(): Int = srtClient.getItemsInCache()

override fun getSentAudioFrames(): Long = srtClient.sentAudioFrames

override fun getSentVideoFrames(): Long = srtClient.sentVideoFrames
Expand All @@ -67,4 +69,12 @@ class SrtStreamClient(
override fun resetDroppedVideoFrames() {
srtClient.resetDroppedVideoFrames()
}

override fun setOnlyAudio(onlyAudio: Boolean) {
srtClient.setOnlyAudio(onlyAudio)
}

override fun setOnlyVideo(onlyVideo: Boolean) {
srtClient.setOnlyVideo(onlyVideo)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ abstract class StreamBaseClient(
abstract fun resizeCache(newSize: Int)
abstract fun clearCache()
abstract fun getCacheSize(): Int
abstract fun getItemsInCache(): Int
abstract fun getSentAudioFrames(): Long
abstract fun getSentVideoFrames(): Long
abstract fun getDroppedAudioFrames(): Long
Expand All @@ -50,4 +51,6 @@ abstract class StreamBaseClient(
abstract fun resetSentVideoFrames()
abstract fun resetDroppedAudioFrames()
abstract fun resetDroppedVideoFrames()
abstract fun setOnlyAudio(onlyAudio: Boolean)
abstract fun setOnlyVideo(onlyVideo: Boolean)
}
2 changes: 2 additions & 0 deletions rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,6 @@ class RtmpClient(private val connectCheckerRtmp: ConnectCheckerRtmp) {
fun clearCache() {
rtmpSender.clearCache()
}

fun getItemsInCache(): Int = rtmpSender.getItemsInCache()
}
2 changes: 2 additions & 0 deletions rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpSender.kt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class RtmpSender(
return cacheSize
}

fun getItemsInCache(): Int = queue.size

fun clearCache() {
queue.clear()
}
Expand Down
2 changes: 2 additions & 0 deletions rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,6 @@ class RtspClient(private val connectCheckerRtsp: ConnectCheckerRtsp) {
fun clearCache() {
rtspSender.clearCache()
}

fun getItemsInCache(): Int = rtspSender.getItemsInCache()
}
2 changes: 2 additions & 0 deletions rtsp/src/main/java/com/pedro/rtsp/rtsp/RtspSender.kt
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ class RtspSender(private val connectCheckerRtsp: ConnectCheckerRtsp) {
return cacheSize
}

fun getItemsInCache(): Int = queue.size

fun clearCache() {
queue.clear()
}
Expand Down
2 changes: 2 additions & 0 deletions srt/src/main/java/com/pedro/srt/srt/SrtClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,6 @@ class SrtClient(private val connectCheckerSrt: ConnectCheckerSrt) {
fun clearCache() {
srtSender.clearCache()
}

fun getItemsInCache(): Int = srtSender.getItemsInCache()
}
2 changes: 2 additions & 0 deletions srt/src/main/java/com/pedro/srt/srt/SrtSender.kt
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ class SrtSender(
return cacheSize
}

fun getItemsInCache(): Int = queue.size

fun clearCache() {
queue.clear()
}
Expand Down

0 comments on commit 107970a

Please sign in to comment.