diff options
| author | JosJuice <josjuice@gmail.com> | 2020-11-21 22:25:57 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-11-27 17:54:08 +0100 |
| commit | d69f243c32d65531a1a4d870a41a85435aafb6d3 (patch) | |
| tree | ffb42070653f7472ff4e8826cfe71550a71b5fd3 /Source/Core/VideoCommon/RenderBase.cpp | |
| parent | 9b03cdf93eec36ac10e95d1ff494ae41441e084e (diff) | |
FrameDump: Start timing at 0 ticks when starting from boot
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 465bf25099..94379909ec 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -1290,7 +1290,7 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6 DolphinAnalytics::Instance().ReportPerformanceInfo(std::move(perf_sample)); if (IsFrameDumping()) - DumpCurrentFrame(xfb_entry->texture.get(), xfb_rect, ticks); + DumpCurrentFrame(xfb_entry->texture.get(), xfb_rect, ticks, m_frame_count); // Begin new frame m_frame_count++; @@ -1380,7 +1380,8 @@ bool Renderer::IsFrameDumping() const } void Renderer::DumpCurrentFrame(const AbstractTexture* src_texture, - const MathUtil::Rectangle<int>& src_rect, u64 ticks) + const MathUtil::Rectangle<int>& src_rect, u64 ticks, + int frame_number) { int source_width = src_rect.GetWidth(); int source_height = src_rect.GetHeight(); @@ -1414,7 +1415,7 @@ void Renderer::DumpCurrentFrame(const AbstractTexture* src_texture, m_frame_dump_readback_texture->CopyFromTexture(src_texture, copy_rect, 0, 0, m_frame_dump_readback_texture->GetRect()); - m_last_frame_state = m_frame_dump.FetchState(ticks); + m_last_frame_state = m_frame_dump.FetchState(ticks, frame_number); m_frame_dump_needs_flush = true; } @@ -1619,7 +1620,11 @@ void Renderer::FrameDumpThreadFunc() bool Renderer::StartFrameDumpToFFMPEG(const FrameDump::FrameData& frame) { - return m_frame_dump.Start(frame.width, frame.height); + // If dumping started at boot, the start time must be set to the boot time to maintain audio sync. + // TODO: Perhaps we should care about this when starting dumping in the middle of emulation too, + // but it's less important there since the first frame to dump usually gets delivered quickly. + const u64 start_ticks = frame.state.frame_number == 0 ? 0 : frame.state.ticks; + return m_frame_dump.Start(frame.width, frame.height, start_ticks); } void Renderer::DumpFrameToFFMPEG(const FrameDump::FrameData& frame) |
