summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioSource.cpp
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2014-08-01 10:30:26 -0700
committerChong Zhang <chz@google.com>2014-08-04 11:59:05 -0700
commit16e79115e497386eaf010af388627f94314a55a3 (patch)
tree600138fd3483f527278304fbf866be53f40e6ea1 /media/libstagefright/AudioSource.cpp
parent44622db93a24219123facbbe14259000f90de728 (diff)
downloadframeworks_av-16e79115e497386eaf010af388627f94314a55a3.zip
frameworks_av-16e79115e497386eaf010af388627f94314a55a3.tar.gz
frameworks_av-16e79115e497386eaf010af388627f94314a55a3.tar.bz2
MediaCodecSource: stop puller from caller's thread instead of looper
Currently CameraSource/AudioSource's stop() and read() are both called from the puller's looper. This works if source operates normally (i.e. read() returns regularly before source is stopped), as the stop() will eventually be handled by the looper. However, if for some reason the source hang, it will get stuck in read(), and the stop() will never be processed, which could lead to ANR (in addition to the source hang). We need to move the source's stop out of the puller's looper. It also can't be on MediaCodecSource's looper, because the source's stop synchrounously waits for all outstanding buffers to return, these are only returned when MediaCodecSource's looper processes the buffer. This change moves the stop to MediaCodecSource::stop, after encoder is shutdown. Bug: 16522726 Change-Id: Ie91f563c5d8a98ab091bf1945af4e51f662b9403
Diffstat (limited to 'media/libstagefright/AudioSource.cpp')
-rw-r--r--media/libstagefright/AudioSource.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index a67fabe..804f131 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -155,12 +155,12 @@ status_t AudioSource::reset() {
}
mStarted = false;
+ mFrameAvailableCondition.signal();
+
mRecord->stop();
waitOutstandingEncodingFrames_l();
releaseQueuedFrames_l();
- mFrameAvailableCondition.signal();
-
return OK;
}