[XMA] Fix consume-only context clear being overwritten in new decoder
This commit is contained in:
@@ -131,7 +131,7 @@ bool XmaContextNew::Work() {
|
|||||||
if (data.IsConsumeOnlyContext()) {
|
if (data.IsConsumeOnlyContext()) {
|
||||||
Consume(&output_rb, &data);
|
Consume(&output_rb, &data);
|
||||||
if (data.output_buffer_read_offset == data.output_buffer_write_offset) {
|
if (data.output_buffer_read_offset == data.output_buffer_write_offset) {
|
||||||
ClearLocked();
|
ClearLocked(&data);
|
||||||
}
|
}
|
||||||
data.Store(context_ptr);
|
data.Store(context_ptr);
|
||||||
return true;
|
return true;
|
||||||
@@ -217,26 +217,25 @@ bool XmaContextNew::Block(bool poll) {
|
|||||||
|
|
||||||
void XmaContextNew::Clear() {
|
void XmaContextNew::Clear() {
|
||||||
std::lock_guard<xe_mutex> lock(lock_);
|
std::lock_guard<xe_mutex> lock(lock_);
|
||||||
ClearLocked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmaContextNew::ClearLocked() {
|
|
||||||
XELOGAPU("XmaContext: reset context {}", id());
|
|
||||||
|
|
||||||
auto context_ptr = memory()->TranslateVirtual(guest_ptr());
|
auto context_ptr = memory()->TranslateVirtual(guest_ptr());
|
||||||
XMA_CONTEXT_DATA data(context_ptr);
|
XMA_CONTEXT_DATA data(context_ptr);
|
||||||
|
ClearLocked(&data);
|
||||||
|
data.Store(context_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
data.input_buffer_0_valid = 0;
|
void XmaContextNew::ClearLocked(XMA_CONTEXT_DATA* data) {
|
||||||
data.input_buffer_1_valid = 0;
|
XELOGAPU("XmaContext: reset context {}", id());
|
||||||
data.output_buffer_valid = 0;
|
|
||||||
|
|
||||||
data.input_buffer_read_offset = 0;
|
data->input_buffer_0_valid = 0;
|
||||||
data.output_buffer_read_offset = 0;
|
data->input_buffer_1_valid = 0;
|
||||||
data.output_buffer_write_offset = 0;
|
data->output_buffer_valid = 0;
|
||||||
data.input_buffer_read_offset = kBitsPerPacketHeader;
|
|
||||||
|
data->input_buffer_read_offset = kBitsPerPacketHeader;
|
||||||
|
data->output_buffer_read_offset = 0;
|
||||||
|
data->output_buffer_write_offset = 0;
|
||||||
|
|
||||||
current_frame_remaining_subframes_ = 0;
|
current_frame_remaining_subframes_ = 0;
|
||||||
data.Store(context_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XmaContextNew::Disable() {
|
void XmaContextNew::Disable() {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class XmaContextNew : public XmaContext {
|
|||||||
void Release();
|
void Release();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ClearLocked();
|
void ClearLocked(XMA_CONTEXT_DATA* data);
|
||||||
static void SwapInputBuffer(XMA_CONTEXT_DATA* data);
|
static void SwapInputBuffer(XMA_CONTEXT_DATA* data);
|
||||||
// Convert sampling rate from ID to frequency.
|
// Convert sampling rate from ID to frequency.
|
||||||
static int GetSampleRate(int id);
|
static int GetSampleRate(int id);
|
||||||
|
|||||||
Reference in New Issue
Block a user