viewer: don't attempt to update still image

Fixes crash when playing audio with muxed still
This commit is contained in:
itsmattkc
2022-11-05 10:13:04 -07:00
parent c06d17cf05
commit c357b04e82
4 changed files with 18 additions and 8 deletions
+10 -4
View File
@@ -388,7 +388,7 @@ void ViewerWidget::SetFullScreen(QScreen *screen)
(*vw->display_widget()->queue()) = *playback_devices_.first()->queue();
if (IsPlaying()) {
vw->display_widget()->Play(GetTimestamp(), playback_speed_, timebase());
vw->display_widget()->Play(GetTimestamp(), playback_speed_, timebase(), true);
}
windows_.insert(screen, vw);
@@ -702,6 +702,12 @@ void ViewerWidget::DetectMulticamNode(const rational &time)
}
}
bool ViewerWidget::IsVideoVisible() const
{
return GetConnectedNode()->GetVideoParams().video_type() != VideoParams::kVideoTypeStill
&& (display_widget_->isVisible() || !windows_.isEmpty());
}
void ViewerWidget::UpdateWaveformViewFromMode()
{
bool prefer_waveform = ShouldForceWaveform();
@@ -954,7 +960,7 @@ void ViewerWidget::PlayInternal(int speed, bool in_to_out_only)
queue_starved_start_ = 0;
// Attempt to fill playback queue
if (display_widget_->isVisible() || !windows_.isEmpty()) {
if (IsVideoVisible()) {
prequeue_length_ = DeterminePlaybackQueueSize();
if (prequeue_length_ > 0) {
@@ -1181,7 +1187,7 @@ void ViewerWidget::FinishPlayPreprocess()
display_widget_->ResetFPSTimer();
foreach (ViewerDisplayWidget *dw, playback_devices_) {
dw->Play(playback_start_time, playback_speed_, timebase());
dw->Play(playback_start_time, playback_speed_, timebase(), IsVideoVisible());
}
// This is our timer for loading the queue and setting the time
@@ -1731,7 +1737,7 @@ void ViewerWidget::PlaybackTimerUpdate()
}
}
if (IsPlaying()) {
if (IsPlaying() && IsVideoVisible()) {
while ((int(display_widget_->queue()->size()) + queue_watchers_.size()) < DeterminePlaybackQueueSize()) {
if (!RequestNextFrameForQueue()) {
// Prevent infinite loop
+2
View File
@@ -282,6 +282,8 @@ private:
void DetectMulticamNode(const rational &time);
bool IsVideoVisible() const;
ViewerSizer* sizer_;
int playback_speed_;
+5 -3
View File
@@ -1241,16 +1241,18 @@ void ViewerDisplayWidget::RequestStartEditingText()
}
}
void ViewerDisplayWidget::Play(const int64_t &start_timestamp, const int &playback_speed, const rational &timebase)
void ViewerDisplayWidget::Play(const int64_t &start_timestamp, const int &playback_speed, const rational &timebase, bool start_updating)
{
playback_timebase_ = timebase;
playback_speed_ = playback_speed;
timer_.Start(start_timestamp, playback_speed, timebase.toDouble());
connect(this, &ViewerDisplayWidget::frameSwapped, this, &ViewerDisplayWidget::UpdateFromQueue);
if (start_updating) {
connect(this, &ViewerDisplayWidget::frameSwapped, this, &ViewerDisplayWidget::UpdateFromQueue);
update();
update();
}
}
void ViewerDisplayWidget::Pause()
+1 -1
View File
@@ -123,7 +123,7 @@ public:
return texture_;
}
void Play(const int64_t &start_timestamp, const int &playback_speed, const rational &timebase);
void Play(const int64_t &start_timestamp, const int &playback_speed, const rational &timebase, bool start_updating);
void Pause();