accel: don't crash on fallback

If no accel is found in getFormatCb, accel->codecCtx_ is null, and
segfaults.

Change-Id: Ibe3b246aaa0620f2dd5b91d2864fff65b6e8b794
This commit is contained in:
philippegorley
2017-11-07 11:26:20 -05:00
committed by Adrien Béraud
parent 04ee614fba
commit 56a78bfbe8

View File

@ -116,8 +116,10 @@ HardwareAccel::fail(bool forceFallback)
fallback_ = true;
allocationFails_ = 0;
extractionFails_ = 0;
codecCtx_->get_format = avcodec_default_get_format;
codecCtx_->get_buffer2 = avcodec_default_get_buffer2;
if (codecCtx_) {
codecCtx_->get_format = avcodec_default_get_format;
codecCtx_->get_buffer2 = avcodec_default_get_buffer2;
}
}
}