aboutsummaryrefslogtreecommitdiff
path: root/components/V4L2Decoder.cpp
diff options
context:
space:
mode:
authorChih-Yu Huang <akahuang@google.com>2020-08-21 13:44:59 +0900
committerChih-Yu Huang <akahuang@google.com>2020-08-25 10:33:32 +0900
commit29ce0780e31dcd638adec5b3d52bb5d4dbe1cf57 (patch)
tree38dd0f8aef9d8da37fab5d3917df68b25c070091 /components/V4L2Decoder.cpp
parent817872ef36643c5d5504074678582450be574cb2 (diff)
downloadv4l2_codec2-29ce0780e31dcd638adec5b3d52bb5d4dbe1cf57.tar.gz
V4L2Decoder: Clear mFrameAtDevice when streamoff the output queue
|mFrameAtDevice| is to track the buffers enqueued in the V4L2 output queue. When we streamoff the V4L2 queue, all of the enqueued buffers are dropped immediately. Therefore we should also clear |mFrameAtDevice| at the same time. Bug: 166072201 Test: Run gts.DashTest#testWidevineVp9AdaptiveWithRendererDisabling and check the error message added by this CL doesn't appear. Change-Id: Ibda5949710e66e78a6f49c80c57e94c93fe69afc
Diffstat (limited to 'components/V4L2Decoder.cpp')
-rw-r--r--components/V4L2Decoder.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/components/V4L2Decoder.cpp b/components/V4L2Decoder.cpp
index f066fd4..a5ef3fb 100644
--- a/components/V4L2Decoder.cpp
+++ b/components/V4L2Decoder.cpp
@@ -317,6 +317,7 @@ void V4L2Decoder::flush() {
// Streamoff V4L2 queues to drop input and output buffers.
mDevice->StopPolling();
mOutputQueue->Streamoff();
+ mFrameAtDevice.clear();
mInputQueue->Streamoff();
// Streamon input queue again.
@@ -471,6 +472,7 @@ bool V4L2Decoder::changeResolution() {
mOutputQueue->Streamoff();
mOutputQueue->DeallocateBuffers();
+ mFrameAtDevice.clear();
mBlockIdToV4L2Id.clear();
if (mOutputQueue->AllocateBuffers(*numOutputBuffers, V4L2_MEMORY_DMABUF) == 0) {
@@ -557,6 +559,11 @@ void V4L2Decoder::onVideoFrameReady(
ALOGV("QBUF to output queue, blockId=%u, V4L2Id=%u", blockId, v4l2Id);
std::move(*outputBuffer).QueueDMABuf(frame->getFDs());
+ if (mFrameAtDevice.find(v4l2Id) != mFrameAtDevice.end()) {
+ ALOGE("%s(): V4L2 buffer %d already enqueued.", __func__, v4l2Id);
+ onError();
+ return;
+ }
mFrameAtDevice.insert(std::make_pair(v4l2Id, std::move(frame)));
tryFetchVideoFrame();