ffmpegdecoder: improve scaler refresh
This commit is contained in:
@@ -173,6 +173,7 @@ void FFmpegDecoder::CloseInternal()
|
||||
}
|
||||
|
||||
ClearFrameCache();
|
||||
FreeScaler();
|
||||
|
||||
instance_.Close();
|
||||
}
|
||||
@@ -677,13 +678,15 @@ void FFmpegDecoder::ClearFrameCache()
|
||||
cached_frames_.clear();
|
||||
cache_at_eof_ = false;
|
||||
cache_at_zero_ = false;
|
||||
|
||||
// Filter graph may rely on "continuous" video frames, so we free the scaler here
|
||||
FreeScaler();
|
||||
InitScaler(filter_params_);
|
||||
}
|
||||
}
|
||||
|
||||
void FFmpegDecoder::ResetScaler()
|
||||
{
|
||||
FreeScaler();
|
||||
InitScaler(filter_params_);
|
||||
}
|
||||
|
||||
FramePtr FFmpegDecoder::RetrieveFrame(const rational& time, const QAtomicInt *cancelled)
|
||||
{
|
||||
int64_t target_ts = GetTimeInTimebaseUnits(time, instance_.avstream()->time_base, instance_.avstream()->start_time, filter_params_.src_interlacing);
|
||||
@@ -698,6 +701,9 @@ FramePtr FFmpegDecoder::RetrieveFrame(const rational& time, const QAtomicInt *ca
|
||||
|| (time < cached_frames_.front()->timestamp() || time > cached_frames_.back()->timestamp() + 2)) {
|
||||
ClearFrameCache();
|
||||
|
||||
// Filter graph may rely on "continuous" video frames, so we free the scaler here
|
||||
ResetScaler();
|
||||
|
||||
instance_.Seek(seek_ts);
|
||||
if (seek_ts == min_seek) {
|
||||
cache_at_zero_ = true;
|
||||
@@ -827,6 +833,7 @@ bool FFmpegDecoder::InitScaler(const RetrieveVideoParams& params)
|
||||
|
||||
// We need to (re)create the filter, delete current if necessary
|
||||
ClearFrameCache();
|
||||
FreeScaler();
|
||||
|
||||
// Set our params to this
|
||||
filter_params_ = params;
|
||||
|
||||
Reference in New Issue
Block a user