reimplement sfr queue clearing

This commit is contained in:
itsmattkc
2022-05-30 22:08:29 -07:00
parent 9918af2614
commit 1e098496be
3 changed files with 16 additions and 2 deletions
+12
View File
@@ -83,6 +83,18 @@ RenderTicketPtr PreviewAutoCacher::GetRangeOfAudio(TimeRange range, RenderTicket
return RenderAudio(copied_viewer_node_->GetConnectedSampleOutput(), range, priority, nullptr);
}
void PreviewAutoCacher::ClearSingleFrameRenders()
{
QMap<RenderTicketWatcher*, QVector<RenderTicketPtr> > copy = video_immediate_passthroughs_;
for (auto it=copy.cbegin(); it!=copy.cend(); it++) {
it.key()->Cancel();
if (!it.key()->IsRunning()) {
RenderManager::instance()->RemoveTicket(it.key()->GetTicket());
emit it.key()->GetTicket()->Finished();
}
}
}
void PreviewAutoCacher::VideoInvalidatedFromCache(const TimeRange &range)
{
PlaybackCache *cache = static_cast<PlaybackCache*>(sender());
+2
View File
@@ -55,6 +55,8 @@ public:
RenderTicketPtr GetRangeOfAudio(TimeRange range, RenderTicketPriority prioritize);
void ClearSingleFrameRenders();
/**
* @brief Set the viewer node to auto-cache
*/
+2 -2
View File
@@ -665,8 +665,7 @@ void ViewerWidget::ForceRequeueFromCurrentTime()
// Allow half a second for requeue to complete
static const rational kRequeueWaitTime(1);
qDebug() << "FIXME: Should be able to clear our frames";
//ClearVideoAutoCacherQueue();
auto_cacher_->ClearSingleFrameRenders();
queue_watchers_.clear();
int queue = DeterminePlaybackQueueSize();
playback_queue_next_frame_ = GetTimestamp() + playback_speed_ * Timecode::time_to_timestamp(kRequeueWaitTime, timebase(), Timecode::kFloor);;
@@ -822,6 +821,7 @@ void ViewerWidget::PauseInternal()
qDeleteAll(queue_watchers_);
queue_watchers_.clear();
auto_cacher_->ClearSingleFrameRenders();
playback_backup_timer_.stop();