diff --git a/components/EncodeComponent.cpp b/components/EncodeComponent.cpp index 5d1d64a6ed32acae52470f76bea23049caaac7d3..45c195216d1e5a77da9ce6fe2df56324ffc6b165 100644 --- a/components/EncodeComponent.cpp +++ b/components/EncodeComponent.cpp @@ -432,6 +432,14 @@ void EncodeComponent::queueTask(std::unique_ptr<C2Work> work) { ALOGV("Queuing next encode (index: %" PRIu64 ", timestamp: %" PRId64 ", EOS: %d)", index, timestamp, endOfStream); + // If input buffer list is not empty, it means we have some input to process + // on. However, input could be a null buffer. In such case, clear the buffer + // list before making call to process(). + if (!work->input.buffers.empty() && !work->input.buffers[0]) { + ALOGD("Encountered null input buffer. Clearing the input buffer"); + work->input.buffers.clear(); + } + // The codec 2.0 framework might queue an empty CSD request, but this is currently not // supported. We will return the CSD with the first encoded buffer work. if (work->input.buffers.empty() && !endOfStream) {