Coder Social home page Coder Social logo

Comments (3)

kolyvan avatar kolyvan commented on August 16, 2024

HI,

Yes I could reproduce this bug. So far I noticed it only for remote streams.
The rought way to workaround it, call closeFile method for _decoder in UIApplicationDidEnterBackgroundNotification.
I will look into problem in more detail and maybe there are another solution.

  • after some googling, there is another solution: just add somewhere

    signal(SIGPIPE, SIG_IGN)

Best wishes.

from kxmovie.

tfalencar avatar tfalencar commented on August 16, 2024

Hi,

Thanks for the suggestions; I have tried the proposed solutions (using both closeFile and SIG_IGN), but still crashes (also on different sections of the code inside [KxMovieDecoder decodeFrames]. I just tried now (play stream, then switch to different app or lock/unlock screen for e.g.) , and got a EXC_BAD_ACCESS inside decodeFrames > av_read_frame_read_frame_internal > ff_read_packet > rtsp_read_packet > ff_rtsp_fetch_packet > furl_get_file_handle.

Sometimes it crashes, sometimes it doesn't; It seems that it depends on which part of the code the execution is when we hit the lock button.

Further tests show that even if we insert the signal(SIGPIPE, SIG_IGN) code, sigpipe is not ignored (still crashes with SIGPIPE for example at KxMovieDecoder closeFile > avformat_close_input > rtsp_read_close > ff_rtsp_send_cmd_async > ff_rtsp_sendcmd_with_content_async > ffurl_write > retry_transfer_wrapper > tcp_write at tcp.c). My guess is that ffmpeg is overriding the flag at another point inside its code.

In a quick test I did manage to make it work (that is, go to background and back to foreground by switching applications with the double-tap in main button, lock / unlock screen etc) and restore playback without crashing, but not in a way that I could properly deallocate the ffmpeg objects (ended up removing [self closeFile] from KxMovieDecoder's dealloc - not a memory-friendly idea at all) ..

I do can manage to properly dispose the objects in any other method within the app, but specifically not within UIApplicationDidEnterBackgroundNotification or applicationWillResignActive or applicationDidEnterBackground for example. I know that iOS will give a little time (not sure how long) for execution inside these calls, so the "intuition" I have is that although iOS gives some "time" for tasks after the user locked the phone to be executed, this time is not being enough to dispose ffmpeg the way it is being done right now (but this is just a supposition I have now).

from kxmovie.

richardlevy avatar richardlevy commented on August 16, 2024

I have this same issue. Are there any further suggestions?

I am playing a local file in my case.

from kxmovie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.