rtsp-client-android icon indicating copy to clipboard operation
rtsp-client-android copied to clipboard

Android MediaCodec dequeueOutputBuffer returns illegal buffer index using gstreamer server

Open hafeelgadgeon opened this issue 3 years ago • 3 comments

Hi, I am using your library to decode an rtsp URL streamed using gstreamer server but i am getting green glitches with a log 'Cannot add frame, queue is full' in some device and in some device app crashes with error

when (val outIndex = decoder.dequeueOutputBuffer(bufferInfo, 10000L)) {
                   MediaCodec.INFO_OUTPUT_FORMAT_CHANGED -> Log.d(TAG, "Decoder format changed: ${decoder.outputFormat}")
                   MediaCodec.INFO_TRY_AGAIN_LATER -> if (DEBUG) Log.d(TAG, "No output from decoder available")
                   else -> {
                       if (outIndex >= 0) {
                           val byteBuffer: ByteBuffer? = decoder.getOutputBuffer(outIndex)

                           val chunk = ByteArray(bufferInfo.size)
                           byteBuffer?.get(chunk)
                           byteBuffer?.clear()

                           if (chunk.isNotEmpty()) {
                               audioTrack.write(chunk, 0, chunk.size)
                           }
                           decoder.releaseOutputBuffer(outIndex, false)
                       }
                   }
               }

Can u also provide the email address so that i can share the Gstreamer server code.

hafeelgadgeon avatar Feb 01 '22 06:02 hafeelgadgeon

facing same problem. if you found any solution then let me know.

sam21abc avatar Mar 15 '22 10:03 sam21abc

i have same problem

ligeirow avatar Aug 13 '22 17:08 ligeirow

the same problem. Did anybody find solution?

NicolasGodfather avatar May 30 '23 08:05 NicolasGodfather