summaryrefslogtreecommitdiffstats
path: root/include/media
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 /include/media
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 'include/media')
-rw-r--r--include/media/stagefright/MediaCodecSource.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/media/stagefright/MediaCodecSource.h b/include/media/stagefright/MediaCodecSource.h
index 4b18a0b..e1b2830 100644
--- a/include/media/stagefright/MediaCodecSource.h
+++ b/include/media/stagefright/MediaCodecSource.h
@@ -106,7 +106,6 @@ private:
bool mStarted;
bool mStopping;
bool mDoMoreWorkPending;
- bool mPullerReachedEOS;
sp<AMessage> mEncoderActivityNotify;
sp<IGraphicBufferProducer> mGraphicBufferProducer;
Vector<sp<ABuffer> > mEncoderInputBuffers;
@@ -123,7 +122,7 @@ private:
Mutex mOutputBufferLock;
Condition mOutputBufferCond;
List<MediaBuffer*> mOutputBufferQueue;
- bool mEncodedReachedEOS;
+ bool mEncoderReachedEOS;
status_t mErrorCode;
DISALLOW_EVIL_CONSTRUCTORS(MediaCodecSource);