Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in demo application: at the end of steaming from camera #1657

Closed
frozar opened this issue Nov 27, 2024 · 4 comments
Closed

Crash in demo application: at the end of steaming from camera #1657

frozar opened this issue Nov 27, 2024 · 4 comments

Comments

@frozar
Copy link

frozar commented Nov 27, 2024

Describe the bug
I use the demo application of this repo. I launch it from AndroidStudio and use the Rotation example. I start the stream from camera : it works successfully.
But when I stop the streaming, the application just crash. There seems to be an issue freeing resources.

To Reproduce
Steps to reproduce the behavior:

  1. Checkout the master branch (dbd7a9e) of this repo
  2. Launch the demo application from Android Studio
  3. Click on the Rotation (include filters) button
  4. Fill the RTMP server URL field
  5. Start the stream
  6. End the stream
  7. At this step, you should see an application crash

Expected behavior
At the step 7 of the above description, I expect to get back to the welcoming view of the application.

Screenshots
Illustration of the crash:
image

Smartphone (please complete the following information):

  • Library version [e.g. 2.2.7]
  • Device: Doogee V20 Pro
  • OS: Android12
  • RTMP media server

Additional context
Somewhere in the logcat, you can see:

--------- beginning of crash
11-27 11:30:21.441 21517 21676 E AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-2
11-27 11:30:21.441 21517 21676 E AndroidRuntime: Process: com.pedro.streamer, PID: 21517
11-27 11:30:21.441 21517 21676 E AndroidRuntime: java.io.IOException: Channel is closed for write
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at io.ktor.utils.io.ByteChannel.getWriteBuffer(ByteChannel.kt:49)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at io.ktor.utils.io.ByteWriteChannelOperationsKt.writeByte(ByteWriteChannelOperations.kt:18)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at io.ktor.network.tls.RenderKt.writeRecord(Render.kt:18)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at io.ktor.network.tls.TLSClientHandshake$output$1.invokeSuspend(TLSClientHandshake.kt:119)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:589)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:832)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:720)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:707)
11-27 11:30:21.441 21517 21676 E AndroidRuntime: 	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [CoroutineName(cio-tls-encoder), ActorCoroutine{Cancelling}@3985a2d, Dispatchers.Default]
11-27 11:30:21.780 21517 21559 D CCodecBufferChannel: elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 0
11-27 11:30:21.780 21517 21559 D CCodecBufferChannel: elapsed: mInputMetEos 0, hasPendingOutputsInClient 1, n 0

So it seems a background worker is struggling to free resources.

@pedroSG94
Copy link
Owner

pedroSG94 commented Nov 27, 2024

Hello,

I was able to reproduce it but only using rtmps. This seems an issue in ktor

@pedroSG94
Copy link
Owner

Hello,

I did a branch to fix this error:
#1658

Can you test it and let me know if the problem persists?

@frozar
Copy link
Author

frozar commented Nov 27, 2024

The PR #1658 fixes this issue.

I let you close this issue as soon as the PR is merged.

@pedroSG94
Copy link
Owner

Merged
You can use this gradle meanwhile I upload the next release:

  implementation 'com.github.pedroSG94.RootEncoder:library:b51a9aa081'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants