diff options
author | François Gaffie <francois.gaffie@renault.com> | 2019-04-12 10:48:55 +0200 |
---|---|---|
committer | Andy Hung <hunga@google.com> | 2019-04-15 14:34:06 -0700 |
commit | 71832e785ca8a596907f627635331553c9c2d721 (patch) | |
tree | 36ab96129eb2414b05ee6c2ee12e002dc071f037 | |
parent | f9539ce315082b3c756213153eb8b6ad991e5977 (diff) | |
download | libhardware-71832e785ca8a596907f627635331553c9c2d721.tar.gz |
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>
-rw-r--r-- | modules/audio_remote_submix/audio_hw.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/audio_remote_submix/audio_hw.cpp b/modules/audio_remote_submix/audio_hw.cpp index 6fac56f0..833c12bb 100644 --- a/modules/audio_remote_submix/audio_hw.cpp +++ b/modules/audio_remote_submix/audio_hw.cpp @@ -805,6 +805,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer, // 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 { |