Do not report error for playback rate/pitch of 1.0
The operation is not mandatory to implement in HAL.
Silently swallow the error from the HAL. For other values
of speed and pitch it should fail as it isn't supported by
the HAL.
If called from NuPlayer with other values for speed and pitch,
the track will recreated as non offloaded.
Bug: 232426500
Test: Use test application in buganizer
Change-Id: Ifc377148f4594e730f9c37426e00c033026c068d
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index 70984b1..3bff484 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -1239,6 +1239,10 @@
legacy2aidl_audio_playback_rate_t_AudioPlaybackRate(playbackRate))));
if (status == NO_ERROR) {
mPlaybackRate = playbackRate;
+ } else if (status == INVALID_OPERATION
+ && playbackRate.mSpeed == 1.0f && mPlaybackRate.mPitch == 1.0f) {
+ mPlaybackRate = playbackRate;
+ return NO_ERROR;
}
return status;
}