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

The app crashes if I start capturing, then exit the app, and open it again #9

Open
lgorse opened this issue Feb 1, 2015 · 11 comments

Comments

@lgorse
Copy link
Contributor

lgorse commented Feb 1, 2015

Here is the flow that consistently crashes the app - can you reproduce it?

  • I start capturing (Streaming)
  • I close the app (by going to a different app for instance, or by tapping the home button on my Android phone)
  • When I reopen the app the record button looks like a recording is not taking place (i.e. clicking it would start a recording) but the upper-lefthand text says "streaming"
  • When I tap on the record button the app crashes.
@lgorse
Copy link
Contributor Author

lgorse commented Mar 31, 2015

This hasn't been addressed yet but here's the error log:

 Process: com.example.lgorse.cineios_test, PID: 7781
    java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
            at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
            at java.util.ArrayList.get(ArrayList.java:308)
            at io.cine.android.streaming.FFmpegMuxer.releaseOutputBufer(FFmpegMuxer.java:244)
            at io.cine.android.streaming.FFmpegMuxer.writeSampleData(FFmpegMuxer.java:165)
            at io.cine.android.streaming.AndroidEncoder.drainEncoder(AndroidEncoder.java:128)
            at io.cine.android.streaming.TextureMovieEncoder.handleFrameAvailable(TextureMovieEncoder.java:264)
            at io.cine.android.streaming.TextureMovieEncoder$EncoderHandler.handleMessage(TextureMovieEncoder.java:409)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:146)
            at io.cine.android.streaming.TextureMovieEncoder.run(TextureMovieEncoder.java:219)
            at java.lang.Thread.run(Thread.java:841)

@trshafer
Copy link
Member

Hey Laurent,

Thanks for bringing this back to our attention. The situation is much worse unfortunately. I'm having a hard time getting the app to stay working for more than 5 seconds on lollipop. All of our issues are coming because of our ffmpeg build. I imagine the two issues are related.

@lgorse
Copy link
Contributor Author

lgorse commented Mar 31, 2015

Bummer!

Is this something you guys are looking at actively, or is it a back burner
project right now?

On Tue, Mar 31, 2015 at 11:43 AM, Thomas Shafer [email protected]
wrote:

Hey Laurent,

Thanks for bringing this back to our attention. The situation is much
worse unfortunately. I'm having a hard time getting the app to stay working
for more than 5 seconds on lollipop. All of our issues are coming because
of our ffmpeg build. I imagine the two issues are related.


Reply to this email directly or view it on GitHub
#9 (comment)
.


Laurent Gorse
MBA, class of 2013
Stanford Graduate School of Business
650.644.9188
[email protected]
gsb.stanford.edu|Facebook: StanfordGSB http://facebook.com/StanfordGSB
|Twitter: @StanfordBiz http://twitter.com/StanfordBiz

@trshafer
Copy link
Member

At this exact moment, we are focusing our efforts on backend fault tolerance and high availability.

@lgorse
Copy link
Contributor Author

lgorse commented Mar 31, 2015

OK so on our end we are not releasing for another 3 weeks, and in any case
never on Lollipop.

I think we'll need to loop back with you guys about this bug at some point
as it may require deeper knowledge of the API than we have - we'll cross
that bridge when we get to it.

Does that make sense and is that how you'd envision pairing with us on this?

On Tue, Mar 31, 2015 at 12:00 PM, Thomas Shafer [email protected]
wrote:

At this exact moment, we are focusing our efforts on backend fault
tolerance and high availability.


Reply to this email directly or view it on GitHub
#9 (comment)
.


Laurent Gorse
MBA, class of 2013
Stanford Graduate School of Business
650.644.9188
[email protected]
gsb.stanford.edu|Facebook: StanfordGSB http://facebook.com/StanfordGSB
|Twitter: @StanfordBiz http://twitter.com/StanfordBiz

@sirvon
Copy link

sirvon commented Apr 2, 2015

hey @igorse have you tried implementing tokbox's offering? if no, why did u choose cineio? hmu on [email protected], if u don't feel comfortable talking here.

@lgorse
Copy link
Contributor Author

lgorse commented Apr 7, 2015

@growlsworth is this a friend of yours?

In any case here is another error that has to do with the muxer. It has started to pop up and I'm not sure what I would have done differently to cause it to appear:

 Process: com.example.lgorse.cineios_test, PID: 14291
    java.lang.OutOfMemoryError
            at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
            at java.nio.MemoryBlock.allocate(MemoryBlock.java:125)
            at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:72)
            at io.cine.android.streaming.FFmpegMuxer.writeSampleData(FFmpegMuxer.java:151)
            at io.cine.android.streaming.AndroidEncoder.drainEncoder(AndroidEncoder.java:128)
            at io.cine.android.streaming.TextureMovieEncoder.handleFrameAvailable(TextureMovieEncoder.java:264)
            at io.cine.android.streaming.TextureMovieEncoder$EncoderHandler.handleMessage(TextureMovieEncoder.java:409)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:146)
            at io.cine.android.streaming.TextureMovieEncoder.run(TextureMovieEncoder.java:219)
            at java.lang.Thread.run(Thread.java:841)

@sirvon
Copy link

sirvon commented Apr 7, 2015

I'm currently getting the same error after a few seconds of broadcasting.

this issue #2
is also dealing with the same error since months ago...

@lgorse
Copy link
Contributor Author

lgorse commented Apr 7, 2015

Hey @sirvon I saw Tokbox but they are only on WebRTC and I'm interested in broadcasting. I like Cine.io a lot because they're an end-to-end solution. This issue with the Muxer has been dangling for a while and I'm hoping they'll focus on getting it fixed really soon.

Usually they are responsive and try to help - this is more an exception than a rule, though it is a blocker for me right now.

@sirvon
Copy link

sirvon commented Apr 8, 2015

i like cineio too but this issue is slowing down progress...
ustream is about to go beta with a broadcasting sdk
tokbox DOES have broadcasting, its in beta. the mechanism is done server side, they'll switch your setup after you have 20+ concurrent users.

tighten up cineio!!

@oleg-t
Copy link

oleg-t commented Jun 9, 2015

After quite a bit of debugging, I found that when I send the app to the background while streaming the muxer does not get shutdown, which caused a crash when the app is re-opened.

In onPause() call
https://github.com/cine-io/cineio-broadcast-android/blob/master/cineio-broadcast-android-sdk/src/main/java/io/cine/android/BroadcastActivity.java#L280
the camera gets released, the renderer is notified, and the GL view is paused. This causes the handleWriteSampleData not to be called.
https://github.com/cine-io/cineio-broadcast-android/blob/master/cineio-broadcast-android-sdk/src/main/java/io/cine/android/streaming/FFmpegMuxer.java#L172

I can see that allTracksFinished() still returns false (as it should) when audio stream signals the end of stream:
https://github.com/cine-io/cineio-broadcast-android/blob/master/cineio-broadcast-android-sdk/src/main/java/io/cine/android/streaming/FFmpegMuxer.java#L229

In a working scenario, the video stream also arrives to that line 229, and shutdown() if called. However, when sending the app to background, it never happens. So, the muxer is not shutdown.

If I comment out the following in the onPause() call

    releaseCamera();
    mGLView.queueEvent(new Runnable() {
        @Override
        public void run() {
            // Tell the renderer that it's about to be paused so it can clean up.
            mRenderer.notifyPausing();
        }
    });
    mGLView.onPause();

then the shutdown() is called, but of course everything else breaks, because the camera is not released, and so on.

I’m not an expert in this domain, so I cannot offer a solution. I've tested with our own fork of the SDK and with your sample app (CineIoExampleApp).

Let me know if there is something I can clarify more about my findings.

This issue is blocking our release. Please advise. Hope to hear from you soon!!

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

4 participants