mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-10-11 22:49:56 +00:00
GS/GSCapture: Flush stale GSCapture audio buffer during state load
This commit is contained in:
+14
-3
@@ -169,6 +169,7 @@ namespace GSCapture
|
||||
static bool ReceivePackets(AVCodecContext* codec_context, AVStream* stream, AVPacket* packet);
|
||||
static bool ProcessAudioPackets(s64 video_pts);
|
||||
static void InternalEndCapture(std::unique_lock<std::mutex>& lock);
|
||||
static void InternalFlush(bool flush_audio_only);
|
||||
static CodecList GetCodecListForContainer(const char* container, AVMediaType type);
|
||||
|
||||
static std::mutex s_lock;
|
||||
@@ -1463,14 +1464,14 @@ std::string GSCapture::GetNextCaptureFileName()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GSCapture::Flush()
|
||||
void GSCapture::InternalFlush(bool flush_audio_only)
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(s_lock);
|
||||
|
||||
if (s_encoding_error)
|
||||
return;
|
||||
|
||||
ProcessAllInFlightFrames(lock);
|
||||
if (!flush_audio_only)
|
||||
ProcessAllInFlightFrames(lock);
|
||||
|
||||
if (IsCapturingAudio())
|
||||
{
|
||||
@@ -1485,6 +1486,16 @@ void GSCapture::Flush()
|
||||
}
|
||||
}
|
||||
|
||||
void GSCapture::Flush()
|
||||
{
|
||||
InternalFlush(false);
|
||||
}
|
||||
|
||||
void GSCapture::FlushAudioOnly()
|
||||
{
|
||||
InternalFlush(true);
|
||||
}
|
||||
|
||||
GSCapture::CodecList GSCapture::GetCodecListForContainer(const char* container, AVMediaType type)
|
||||
{
|
||||
CodecList ret;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace GSCapture
|
||||
GSVector2i GetSize();
|
||||
std::string GetNextCaptureFileName();
|
||||
void Flush();
|
||||
|
||||
void FlushAudioOnly();
|
||||
using CodecName = std::pair<std::string, std::string>; // shortname,longname
|
||||
using CodecList = std::vector<CodecName>;
|
||||
CodecList GetVideoCodecList(const char* container);
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@
|
||||
#include "GS.h"
|
||||
#include "GS/Renderers/HW/GSTextureReplacements.h"
|
||||
#include "GSDumpReplayer.h"
|
||||
#include "GS/GSCapture.h"
|
||||
#include "GameDatabase.h"
|
||||
#include "GameList.h"
|
||||
#include "Host.h"
|
||||
@@ -1910,7 +1911,7 @@ bool VMManager::DoLoadState(const char* filename, Error* error)
|
||||
Error::SetString(error, TRANSLATE_STR("VMManager", "Cannot load state while replaying a GS dump."));
|
||||
return false;
|
||||
}
|
||||
|
||||
GSCapture::FlushAudioOnly();
|
||||
Host::OnSaveStateLoading(filename);
|
||||
|
||||
if (!SaveState_UnzipFromDisk(filename, error))
|
||||
|
||||
Reference in New Issue
Block a user