Fix for movies shorter than the buffer size.
This commit is contained in:
@@ -225,6 +225,10 @@ int MovieDecoder_FFMpeg::HandleNextPacket() {
|
|||||||
// total number of frames. This is benign even if we did have an
|
// total number of frames. This is benign even if we did have an
|
||||||
// accurate frame count at the start.
|
// accurate frame count at the start.
|
||||||
total_frames_ = packet_buffer_.size();
|
total_frames_ = packet_buffer_.size();
|
||||||
|
if (total_frames_ < frame_buffer_.size()) {
|
||||||
|
LOG->Trace("Video shorter than frame buffer, shrinking the buffer.");
|
||||||
|
frame_buffer_.resize(total_frames_);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
@@ -575,6 +579,10 @@ RString MovieDecoder_FFMpeg::Open(RString sFile)
|
|||||||
* (av_stream_->avg_frame_rate.num) / (av_stream_->avg_frame_rate.den) / (1000000);
|
* (av_stream_->avg_frame_rate.num) / (av_stream_->avg_frame_rate.den) / (1000000);
|
||||||
LOG->Trace("Number of frames provided is inaccurate, estimating.");
|
LOG->Trace("Number of frames provided is inaccurate, estimating.");
|
||||||
}
|
}
|
||||||
|
if (total_frames_ < frame_buffer_.size()) {
|
||||||
|
LOG->Trace("Video shorter than frame buffer, shrinking the buffer.");
|
||||||
|
frame_buffer_.resize(total_frames_);
|
||||||
|
}
|
||||||
LOG->Trace("Number of frames detected: %i", total_frames_);
|
LOG->Trace("Number of frames detected: %i", total_frames_);
|
||||||
|
|
||||||
return RString();
|
return RString();
|
||||||
|
|||||||
Reference in New Issue
Block a user