CasparCG / server

CasparCG Server is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs. It has been in 24/7 broadcast production since 2006. Ready-to-use downloads are available under the Releases tab https://casparcg.com.
GNU General Public License v3.0
901 stars 269 forks source link

Seeking some formats cause CasparCG server to crash #1451

Open Bohoaush opened 1 year ago

Bohoaush commented 1 year ago

Expected behaviour

Seek video and start playing

Current behaviour

Crash of CasparCG server - "Aborted (core dumped)" full log bellow


Steps to reproduce

  1. Download file seekTOcrash.mpg (bellow) to your media folder
  2. Start CasparCG server
  3. Send command PLAY 1-1 seekTOcrash SEEK 20

Environment


Additional information & resources

Bohoaush commented 1 year ago

Hi, The log said the error was thrown at line 156 of av_producer.cpp so I was able to mitigate the crash by adding catch(ffmpeg::ffmpeg_error_t) block to an already existing try with catch for boost::thread_interrupted&. Now it will countinue to play what it was playing and write [warning] ffmpeg[seekTOcrash.mpg|0.0000/31.9200] Waiting for audio frame... (e.g. sending PLAY 1-1 abcd, then PLAY 1-1 efgh SEEK 20 will result in abcd file still playing and said warnings). I will continue to look into it, but I don't really know c++, so my understanding of what's going on in there is very limited. Any help much appreciated.

Bohoaush commented 1 year ago

Hi again, I was able to solve the problem by copying the whole try block into my new catch block (see previous comment). I will continue to look into this, but I don't think I am capable of doing a propper fix.

jpc0 commented 1 year ago

This and possibly crash related to issue 1460 was added in commit b657428

jpc0 commented 1 year ago

This is the previous threading logic that caught the exception in the commit just before. It still exists in commit b657428 here but no longer catches the error.

I think adding the following catches, which were used to catch this error before, into the catch block mentioned in pull request 1452 would solve the problem.

catch (ffmpeg::ffmpeg_error_t& ex) {
                if (auto errn = boost::get_error_info<ffmpeg_errn_info>(ex)) {
                    if (*errn == AVERROR_EXIT) {
                        return;
                    }
                }
                CASPAR_LOG_CURRENT_EXCEPTION();
            } catch (...) {
                CASPAR_LOG_CURRENT_EXCEPTION();
            }