Skip to content

Commit

Permalink
Fix freeze on invalid videos
Browse files Browse the repository at this point in the history
  • Loading branch information
Setadokalo authored and EIREXE committed Dec 4, 2023
1 parent 90720bf commit b445a75
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions ffmpeg_video_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ void FFmpegVideoStreamPlayback::update_internal(double p_delta) {
}
} else if (decoder->get_decoder_state() == VideoDecoder::DecoderState::END_OF_STREAM) {
playing = false;
return;
}

Ref<DecodedFrame> peek_frame = available_frames.size() > 0 ? available_frames[0] : nullptr;
Expand Down Expand Up @@ -217,13 +216,13 @@ void FFmpegVideoStreamPlayback::set_paused_internal(bool p_paused) {
}

void FFmpegVideoStreamPlayback::play_internal() {
if (!playing && decoder->get_decoder_state() == VideoDecoder::RUNNING) {
clear();
playback_position = 0;
decoder->seek(0, true);
} else {
stop_internal();
if (decoder->get_decoder_state() == VideoDecoder::FAULTED) {
playing = false;
return;
}
clear();
playback_position = 0;
decoder->seek(0, true);
playing = true;
}

Expand Down

0 comments on commit b445a75

Please sign in to comment.