Skip to content

RtspStream.stopRecord() sometimes blocks in Service.onDestroy() since 2.8.1 #2192

Description

@legosaro

Describe the bug
After upgrading the library from version 2.6.7 to 2.8.1, RtspStream.stopRecord() sometimes blocks when it is called from the onDestroy() method of an Android Service.
With library version 2.6.7, the same implementation worked correctly.
When the issue occurs, the call to:
rtspStream.stopRecord()
does not appear to return. The expected RecordController onStatusChange STOPPED event is not received.
The issue is intermittent and does not occur every time the Service is destroyed.

To Reproduce
Steps to reproduce the behavior:

Use com.github.pedroSG94.RootEncoder:library:2.8.1.
Use an Android 13 custom device.
Create and start an RtspStream.
Start recording.
Destroy the Android Service that manages the stream.
Call rtspStream.stopRecord() from the Service onDestroy() method.
In some cases, stopRecord() appears to block.
The expected RecordController onStatusChange STOPPED event is never received.
Code after rtspStream.stopRecord() is not executed.

The same steps work correctly with library version 2.6.7.

Expected behavior
rtspStream.stopRecord() should complete normally when called from the Service onDestroy() method.
The RecordController should emit the STOPPED status event and execution should continue with the code following rtspStream.stopRecord().
This behavior worked correctly with library version 2.6.7.

Library version: 2.8.1
Device: Custom Android device
OS: Android 13
Media server: RTSP
Class used: RtspStream

Additional context
The application uses:

implementation "com.github.pedroSG94.RootEncoder:library:2.8.1"

The problem appears to be a regression between library versions 2.6.7 and 2.8.1, since the same application code and device configuration worked correctly with version 2.6.7.

The relevant code is executed from the onDestroy() method of an Android Service:

override fun onDestroy() {
// ...
rtspStream.stopRecord()
// These instructions are not executed when the issue occurs
// ...
super.onDestroy()
}

When the problem occurs, execution stops at rtspStream.stopRecord(). I do not receive the expected:
RecordController onStatusChange STOPPED callback.

The issue is intermittent: sometimes stopRecord() works correctly, while other times it appears to remain blocked indefinitely.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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