Open AnthonyWu-kkstream opened 1 month ago
I don't know what do you mean with "verify that the current frame is correct" but you have multiple methods related to get info about frames in the stream:
abstract fun hasCongestion(percentUsed: Float): Boolean
@Throws(RuntimeException::class)
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
abstract fun getDroppedVideoFrames(): Long
abstract fun resetSentAudioFrames()
abstract fun resetSentVideoFrames()
abstract fun resetDroppedAudioFrames()
abstract fun resetDroppedVideoFrames()
You can access all this methods with:
rtmpStream.getStreamClient().hasCongestion(20f)
Hello @pedroSG94 , thanks your reply. Apologies for the confusion earlier. What I meant to ask is whether there’s a listener mechanism that allows me to capture and inspect RTMP packet-related information, rather than verifying if the current frame is correct. I’m looking for a way to better understand the instability during streaming when network speeds are poor.
I don't have a way to do it. I think It is not a correct way to work, return frames is not recommended. What do you want to check in the frame to know if the frame is correct?
I aim to define the streaming status based on RTMP packet information to provide the client app with the current streaming status. Therefore, I am looking for a way to use RTMP information to determine the status.
But you don't need get frames to know if the stream status is poor. You can use the bitrate and the method hasCongestion to know it.
If your internet speed is not enough to send frames the bitrate provided in the callback will be lower than the provided in prepareVideo + prepareAudio methods.
Also, you can check if frames in cache increase or the percent of the cache filled to know if you can't send frames with enough speed using hasCongestion method and methods provided in my other comment.
Hello, I got it. Thanks your idea and suggestion.
Hello @pedroSG94, I have a situation where, when the network speed is very poor, the streaming becomes unstable or even stops. Is there a way to listen to the frames of RTMP packets so that I can use the packet information to verify that the current frame is correct?