File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed
Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -159,11 +159,6 @@ struct XMA_CONTEXT_DATA {
159159 const bool IsConsumeOnlyContext () const {
160160 return (input_buffer_0_packet_count | input_buffer_1_packet_count) == 0 ;
161161 }
162- // Whether the SDC-based minimum exceeds the output buffer size.
163- const bool HasTightOutputBuffer () const {
164- return (int32_t )((subframe_decode_count * 2 ) - 1 ) >
165- (int32_t )output_buffer_block_count;
166- }
167162};
168163static_assert_size (XMA_CONTEXT_DATA, 64 );
169164
Original file line number Diff line number Diff line change @@ -129,21 +129,15 @@ bool XmaContextNew::Work() {
129129 RingBuffer output_rb = PrepareOutputRingBuffer (&data);
130130
131131 if (data.IsConsumeOnlyContext ()) {
132+ // Nothing to drain — don't touch the context or we'll reset the
133+ // game's output buffer offsets, causing stale PCM to be re-read.
134+ if (current_frame_remaining_subframes_ == 0 ) {
135+ return true ;
136+ }
132137 XELOGAPU (" XmaContext {}: Consume-only context, draining subframes" , id ());
133138 Consume (&output_rb, &data);
134139 data.output_buffer_write_offset =
135140 output_rb.write_offset () / kOutputBytesPerBlock ;
136- // Clearing contexts that match TightBufferOutput heuristic can disrupt
137- // playback (e.g. audio noise during races in PGR4), so we only clear
138- // contexts with enough output buffer headroom where empty input reliably
139- // indicates the stream is finished (e.g. needed for dialog completion in
140- // Borderlands 2 startup).
141- if (!data.HasTightOutputBuffer () &&
142- current_frame_remaining_subframes_ == 0 && output_rb.empty ()) {
143- XELOGAPU (" XmaContext {}: Consume-only context fully drained, clearing" ,
144- id ());
145- ClearLocked (&data);
146- }
147141 StoreContextMerged (data, initial_data, context_ptr);
148142 return true ;
149143 }
You can’t perform that action at this time.
0 commit comments