From 20288210be4e928d7e389804090cbf1e141b678a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Fri, 20 Jul 2018 19:37:54 -0700 Subject: [PATCH] Fix VT video centering after transition from windowed to full screen --- app/streaming/session.cpp | 6 ++++++ app/streaming/video/ffmpeg-renderers/vt.mm | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/app/streaming/session.cpp b/app/streaming/session.cpp index ac6ed9a8..3f4761b3 100644 --- a/app/streaming/session.cpp +++ b/app/streaming/session.cpp @@ -629,6 +629,12 @@ void Session::exec() break; } + case SDL_WINDOWEVENT: + if (event.window.event != SDL_WINDOWEVENT_RESIZED) { + break; + } + + // Fall through to recreate decoder on resize (full-screen toggle) case SDL_RENDER_DEVICE_RESET: case SDL_RENDER_TARGETS_RESET: SDL_AtomicLock(&m_DecoderLock); diff --git a/app/streaming/video/ffmpeg-renderers/vt.mm b/app/streaming/video/ffmpeg-renderers/vt.mm index 106aaea0..6f3395c2 100644 --- a/app/streaming/video/ffmpeg-renderers/vt.mm +++ b/app/streaming/video/ffmpeg-renderers/vt.mm @@ -48,6 +48,10 @@ public: AVFrame* frame = m_FrameQueue.dequeue(); av_frame_free(&frame); } + + if (m_View != nullptr) { + [m_View removeFromSuperview]; + } } void drawFrame(uint64_t vsyncTime)