mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
deps/media-playback: Don't exit thread on AVERROR_EXIT
The interrupt callback is designed to prevent the media source from blocking; FFmpeg will internally call it periodically to prevent FFmpeg function calls from blocking too long, and allow the caller to determine whether blocking should stop. The problem with this however is that AVERROR_EXIT causes the thread to completely exit. This fixes it so that it treats it as an EOF rather than as an abnormal error.
This commit is contained in:
parent
3a49d48062
commit
2fae85ab4a
4
deps/media-playback/media-playback/media.c
vendored
4
deps/media-playback/media-playback/media.c
vendored
|
@ -139,7 +139,7 @@ static int mp_media_next_packet(mp_media_t *media)
|
|||
|
||||
int ret = av_read_frame(media->fmt, &pkt);
|
||||
if (ret < 0) {
|
||||
if (ret != AVERROR_EOF)
|
||||
if (ret != AVERROR_EOF && ret != AVERROR_EXIT)
|
||||
blog(LOG_WARNING, "MP: av_read_frame failed: %s (%d)",
|
||||
av_err2str(ret), ret);
|
||||
return ret;
|
||||
|
@ -230,7 +230,7 @@ static bool mp_media_prepare_frames(mp_media_t *m)
|
|||
while (!mp_media_ready_to_start(m)) {
|
||||
if (!m->eof) {
|
||||
int ret = mp_media_next_packet(m);
|
||||
if (ret == AVERROR_EOF)
|
||||
if (ret == AVERROR_EOF || ret == AVERROR_EXIT)
|
||||
m->eof = true;
|
||||
else if (ret < 0)
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue