summaryrefslogtreecommitdiffstats
path: root/media/libmedia/IAudioTrack.cpp
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2009-11-04 08:27:26 -0800
committerEric Laurent <elaurent@google.com>2009-11-04 23:47:21 -0800
commit34f1d8ecd23169a5f299937e3aaf1bd7937578a0 (patch)
tree04f5504f74df6dde00b495a95bf30766be12821a /media/libmedia/IAudioTrack.cpp
parentc6c6237a67661c7b2d8822b7360cdf01e64d2c7c (diff)
downloadframeworks_av-34f1d8ecd23169a5f299937e3aaf1bd7937578a0.zip
frameworks_av-34f1d8ecd23169a5f299937e3aaf1bd7937578a0.tar.gz
frameworks_av-34f1d8ecd23169a5f299937e3aaf1bd7937578a0.tar.bz2
Fix issue 2203561: Sholes: audio playing out of earpiece.
Create a new IAudioTrack interface to AudioFlinger when start() fails due to a broken pipe error. Do the same if start fails due to the same error after time out in obtainBuffer(). Do not indicate that the AudioTrack is started to AudioPolicyManager if IAudioTrack start fails. This avoids that an AudioTrack keeps a dead IAudioTrack after a media server crash. Same modifications for AudioRecord. Add a flag to ToneGenerator indicating that the callback thread can call Java. Without it, when the media server crashes and restarts, the AudioSystem error callback will crash in JNI if the IAudiotrack is created from AudioTrack callback thread.
Diffstat (limited to 'media/libmedia/IAudioTrack.cpp')
-rw-r--r--media/libmedia/IAudioTrack.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/media/libmedia/IAudioTrack.cpp b/media/libmedia/IAudioTrack.cpp
index 7f43347..01ffd75 100644
--- a/media/libmedia/IAudioTrack.cpp
+++ b/media/libmedia/IAudioTrack.cpp
@@ -15,6 +15,10 @@
** limitations under the License.
*/
+#define LOG_TAG "IAudioTrack"
+//#define LOG_NDEBUG 0
+#include <utils/Log.h>
+
#include <stdint.h>
#include <sys/types.h>
@@ -45,8 +49,13 @@ public:
{
Parcel data, reply;
data.writeInterfaceToken(IAudioTrack::getInterfaceDescriptor());
- remote()->transact(START, data, &reply);
- return reply.readInt32();
+ status_t status = remote()->transact(START, data, &reply);
+ if (status == NO_ERROR) {
+ status = reply.readInt32();
+ } else {
+ LOGW("start() error: %s", strerror(-status));
+ }
+ return status;
}
virtual void stop()