Fix remote submix MIX_RECORD stop

Since rework of presentationTimestamp in AudioFlinger, it is expecting
to drain correctly before stopping an output.
When a MIX RECORDER is set,
1/ Dynamic Policy Mix is registered
2/ Extraction Sink Port is made available
3/ Player is started on this sink
4/ Extraction source port is connected upon start Output
4/ Capture may be launched on the source to be rerouted
5/ All Capture are stopped, player is stopped
6/ Extraction source port shall be disconnected on stopOutput

Step 6 does not happen as the track is never set as drained.

Upon capture stop, rxSink MonoPipe is put in shutdown state. Any further
write will discard the buffer. However, frames written shall be
incremented of these frame discarded to be able to set the track as
drained.

This CL fixes this issue.

Test: AudioPolicyEmulatorTests --gtest_filter=RecordInjectionSourceMatch/DynamicPolicyMixRecordInjectionTest.RecordingInjection/*
Bug: 130356101
Change-Id: I861c4867991da8bcc1090be56d64e69646d58dc2
Signed-off-by: François Gaffie <francois.gaffie@renault.com>
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp
index 6fac56f..833c12b 100644
--- a/modules/audio_remote_submix/audio_hw.cpp
+++ b/modules/audio_remote_submix/audio_hw.cpp
@@ -805,6 +805,11 @@
             // the pipe has already been shutdown, this buffer will be lost but we must
             //   simulate timing so we don't drain the output faster than realtime
             usleep(frames * 1000000 / out_get_sample_rate(&stream->common));
+
+            pthread_mutex_lock(&rsxadev->lock);
+            out->frames_written += frames;
+            out->frames_written_since_standby += frames;
+            pthread_mutex_unlock(&rsxadev->lock);
             return bytes;
         }
     } else {