Skip to content

Commit

Permalink
Fix cutting off end of videos (#11)
Browse files Browse the repository at this point in the history
Co-authored-by: Álex Román Núñez <[email protected]>
  • Loading branch information
Setadokalo and EIREXE authored Dec 4, 2023
1 parent b445a75 commit f04b05e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ffmpeg_video_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ void FFmpegVideoStreamPlayback::update_internal(double p_delta) {
// if at the end of the stream but our playback enters a valid time region again, a seek operation is required to get the decoder back on track.
if (playback_position < decoder->get_last_decoded_frame_time()) {
seek_into_sync();
} else {
playing = false;
}
} else if (decoder->get_decoder_state() == VideoDecoder::DecoderState::END_OF_STREAM) {
playing = false;
}

Ref<DecodedFrame> peek_frame = available_frames.size() > 0 ? available_frames[0] : nullptr;
Expand Down
6 changes: 1 addition & 5 deletions video_decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,7 @@ void VideoDecoder::_read_decoded_frames(AVFrame *p_received_frame) {
}
}
unwrapped_frame.resize(width * height * 4);
if (!image.is_valid()) {
image = Image::create_from_data(width, height, false, Image::FORMAT_RGBA8, unwrapped_frame);
} else {
image->set_data(width, height, false, Image::FORMAT_RGBA8, unwrapped_frame);
}
image = Image::create_from_data(width, height, false, Image::FORMAT_RGBA8, unwrapped_frame);
}
#ifdef FFMPEG_MT_GPU_UPLOAD
Ref<ImageTexture> tex;
Expand Down

0 comments on commit f04b05e

Please sign in to comment.