Skip to content

Commit

Permalink
clear video info
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroSG94 committed Oct 13, 2024
1 parent c626938 commit 51f186d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion rtmp/src/main/java/com/pedro/rtmp/rtmp/CommandsManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ abstract class CommandsManager {
abstract suspend fun sendPublishImp(socket: RtmpSocket)
abstract suspend fun sendCloseImp(socket: RtmpSocket)

fun reset() {
fun reset(clear: Boolean) {
startTs = 0
timestamp = 0
streamId = 0
Expand All @@ -256,5 +256,10 @@ abstract class CommandsManager {
sessionHistory.reset()
acknowledgementSequence = 0
bytesRead = 0
if (clear) {
sps = null
pps = null
vps = null
}
}
}
4 changes: 2 additions & 2 deletions rtmp/src/main/java/com/pedro/rtmp/rtmp/RtmpClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ class RtmpClient(private val connectChecker: ConnectChecker) {

private suspend fun closeConnection() {
socket?.close()
commandsManager.reset()
commandsManager.reset(false)
}

@JvmOverloads
Expand Down Expand Up @@ -563,7 +563,7 @@ class RtmpClient(private val connectChecker: ConnectChecker) {
scope.cancel()
scope = CoroutineScope(Dispatchers.IO)
publishPermitted = false
commandsManager.reset()
commandsManager.reset(clear)
}

fun sendVideo(videoBuffer: ByteBuffer, info: MediaCodec.BufferInfo) {
Expand Down

0 comments on commit 51f186d

Please sign in to comment.