mirror of
https://github.com/libretro/mgba.git
synced 2024-11-23 07:59:46 +00:00
FFmpeg: Fix crash when -strict -2 is needed for vcodec or container
This commit is contained in:
parent
d33f1d1392
commit
b192e6b5ed
1
CHANGES
1
CHANGES
@ -18,6 +18,7 @@ Other fixes:
|
||||
- Core: Fix race condition initializing thread proxy
|
||||
- Core: Ensure ELF regions can be written before trying
|
||||
- Core: Fix integer overflow in ELF loading
|
||||
- FFmpeg: Fix crash when -strict -2 is needed for vcodec or container
|
||||
- Qt: Only dynamically reset video scale if a game is running
|
||||
- Qt: Fix race condition with proxied video events
|
||||
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
||||
|
@ -445,8 +445,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
||||
encoder->sinkFrame = avcodec_alloc_frame();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (avcodec_open2(encoder->video, vcodec, 0) < 0) {
|
||||
AVDictionary* opts = 0;
|
||||
av_dict_set(&opts, "strict", "-2", 0);
|
||||
int res = avcodec_open2(encoder->video, vcodec, &opts);
|
||||
av_dict_free(&opts);
|
||||
if (res < 0) {
|
||||
FFmpegEncoderClose(encoder);
|
||||
return false;
|
||||
}
|
||||
@ -466,7 +469,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (avio_open(&encoder->context->pb, outfile, AVIO_FLAG_WRITE) < 0 || avformat_write_header(encoder->context, 0) < 0) {
|
||||
AVDictionary* opts = 0;
|
||||
av_dict_set(&opts, "strict", "-2", 0);
|
||||
bool res = avio_open(&encoder->context->pb, outfile, AVIO_FLAG_WRITE) < 0 || avformat_write_header(encoder->context, &opts) < 0;
|
||||
av_dict_free(&opts);
|
||||
if (res) {
|
||||
FFmpegEncoderClose(encoder);
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user