summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
diff options
context:
space:
mode:
authorZhijun He <zhijunhe@google.com>2014-06-18 11:43:02 -0700
committerZhijun He <zhijunhe@google.com>2014-06-18 14:12:49 -0700
commit60800208d31bc5a0770c3acb4f7df53c6bb1ac39 (patch)
tree89da045692283fe4993756ef2f27c495b10c5c90 /services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
parent7a4d7d6670f1766442b54045fb420dbf42b75750 (diff)
downloadframeworks_av-60800208d31bc5a0770c3acb4f7df53c6bb1ac39.zip
frameworks_av-60800208d31bc5a0770c3acb4f7df53c6bb1ac39.tar.gz
frameworks_av-60800208d31bc5a0770c3acb4f7df53c6bb1ac39.tar.bz2
Camera2/3: Don't release recording buffer when stream is active
It is dangerous to release all recording buffers when recording stream is actively sending buffer to encoder. This change only releases all buffers when recording stream is idle and recording stream is about to start. Bug: 15667833 Change-Id: Ia4a84cac84a2062c13333467c66698273ffb0e23
Diffstat (limited to 'services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp')
-rw-r--r--services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
index 2064e2c..99abced 100644
--- a/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
+++ b/services/camera/libcameraservice/api1/client2/StreamingProcessor.cpp
@@ -430,10 +430,13 @@ status_t StreamingProcessor::startStream(StreamType type,
Mutex::Autolock m(mMutex);
- // If a recording stream is being started up, free up any
- // outstanding buffers left from the previous recording session.
- // There should never be any, so if there are, warn about it.
- if (isStreamActive(outputStreams, mRecordingStreamId)) {
+ // If a recording stream is being started up and no recording
+ // stream is active yet, free up any outstanding buffers left
+ // from the previous recording session. There should never be
+ // any, so if there are, warn about it.
+ bool isRecordingStreamIdle = !isStreamActive(mActiveStreamIds, mRecordingStreamId);
+ bool startRecordingStream = isStreamActive(outputStreams, mRecordingStreamId);
+ if (startRecordingStream && isRecordingStreamIdle) {
releaseAllRecordingFramesLocked();
}