Skip to content

Restart Stream in Sample App? #2039

@mressler

Description

@mressler

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.

  1. 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?

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions