Hi,
We're using RootEncoder and need to restart the stream while keeping the recording active (stop the stream, then start it again without stopping the recording). While investigating this, we've run into two issues and would like to know the intended approach.
- In the sample app's
CameraFragment (app/src/main/java/com/pedro/streamer/rotation/CameraFragment.kt), in bStartStop.setOnClickListener, we tried adding a startStream right after stopStream to simulate "restart stream while still recording":
} else {
genericStream.stopStream()
genericStream.startStream(etUrl.text.toString()) // added: restart stream
bStartStop.setImageResource(R.drawable.stream_icon)
}
After stopping the stream, the second startStream call doesn't actually bring the stream back (no connection or no data). We're not sure if we need to wait for something (e.g., callbacks), re-prepare, or use a different API when we want to restart only the stream while recording continues. What is the recommended way to restart the stream while recording is still active?
- In our app, we use RTMPCamera2 (not GenericStream) and perform
stopStream() followed by startStream(). After the restart, we see these OpenGL/EGL errors:
BufferQueueProducer: [GraphicBufferSource](...) dequeueBuffer: BufferQueue has been abandoned
libEGL: eglMakeCurrentImpl:1100 error 3009 (EGL_BAD_MATCH)
SurfaceManager: eglMakeCurrent failed
libEGL: eglMakeCurrentImpl:1100 error 300b (EGL_BAD_NATIVE_WINDOW)
SurfaceManager: eglMakeCurrent failed
So it looks like after stopping the stream, something in the EGL/surface/encoder pipeline is left in a bad state when we call startStream() again. Is stream restart (stopStream then startStream) supported on RTMPCamera2 / Camera2Base, and if so, is there a recommended sequence or any need to re-prepare video/audio or delay before calling startStream() again?
We're happy to provide more details.
Thanks for any guidance you can give.
Hi,
We're using RootEncoder and need to restart the stream while keeping the recording active (stop the stream, then start it again without stopping the recording). While investigating this, we've run into two issues and would like to know the intended approach.
CameraFragment(app/src/main/java/com/pedro/streamer/rotation/CameraFragment.kt), inbStartStop.setOnClickListener, we tried adding astartStreamright afterstopStreamto simulate "restart stream while still recording":After stopping the stream, the second
startStreamcall doesn't actually bring the stream back (no connection or no data). We're not sure if we need to wait for something (e.g., callbacks), re-prepare, or use a different API when we want to restart only the stream while recording continues. What is the recommended way to restart the stream while recording is still active?stopStream()followed bystartStream(). After the restart, we see these OpenGL/EGL errors:So it looks like after stopping the stream, something in the EGL/surface/encoder pipeline is left in a bad state when we call
startStream()again. Is stream restart (stopStream then startStream) supported on RTMPCamera2 / Camera2Base, and if so, is there a recommended sequence or any need to re-prepare video/audio or delay before callingstartStream()again?We're happy to provide more details.
Thanks for any guidance you can give.