You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Fix a huge regression which invokes the avcodec_open() method twice for every call to FFmpegReader::Open(), leaving many threads running and never joined/closed. Also, adding some additional error message when attempting to call avcodec_open().
This commit is contained in:
@@ -426,8 +426,12 @@ void FFmpegReader::Open() {
|
||||
}
|
||||
|
||||
// Open video codec
|
||||
if (avcodec_open2(pCodecCtx, pCodec, &opts) < 0)
|
||||
throw InvalidCodec("A video codec was found, but could not be opened.", path);
|
||||
int avcodec_return = avcodec_open2(pCodecCtx, pCodec, &opts);
|
||||
if (avcodec_return < 0) {
|
||||
std::stringstream avcodec_error_msg;
|
||||
avcodec_error_msg << "A video codec was found, but could not be opened. Error: " << av_err2string(avcodec_return);
|
||||
throw InvalidCodec(avcodec_error_msg.str(), path);
|
||||
}
|
||||
|
||||
#if USE_HW_ACCEL
|
||||
if (hw_de_on && hw_de_supported) {
|
||||
@@ -569,13 +573,13 @@ void FFmpegReader::Open() {
|
||||
CheckFPS();
|
||||
}
|
||||
|
||||
// Mark as "open"
|
||||
is_open = true;
|
||||
|
||||
// Seek back to beginning of file (if not already seeking)
|
||||
if (!is_seeking) {
|
||||
Seek(1);
|
||||
}
|
||||
|
||||
// Mark as "open"
|
||||
is_open = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user