diff --git a/frameworks/native/avcodec/avcodec_audio_codec_impl.cpp b/frameworks/native/avcodec/avcodec_audio_codec_impl.cpp index 0c32f39747cf4d3e93b9f741aec6a91675a9a3d2..fec056f0369bfd9fb86940ff9e0ce42810398367 100644 --- a/frameworks/native/avcodec/avcodec_audio_codec_impl.cpp +++ b/frameworks/native/avcodec/avcodec_audio_codec_impl.cpp @@ -202,13 +202,7 @@ int32_t AVCodecAudioCodecImpl::QueueInputBuffer(uint32_t index) inputBufferObjMap_.erase(index); } CHECK_AND_RETURN_RET_LOG(buffer != nullptr, AVCS_ERR_INVALID_STATE, "buffer not found"); - if (buffer->flag_ == AVCODEC_BUFFER_FLAG_EOS) { - AVCODEC_LOGI("EOS detected, QueueInputBuffer set eos status."); - codecService_->NotifyEos(); - } - mediaCodecProducer_->PushBuffer(buffer, true); - return 0; } @@ -232,6 +226,12 @@ int32_t AVCodecAudioCodecImpl::ReleaseOutputBuffer(uint32_t index) buffer = outputBufferObjMap_[index]; outputBufferObjMap_.erase(index); } + CHECK_AND_RETURN_RET_LOG(buffer != nullptr, AVCS_ERR_INVALID_STATE, "buffer is nullptr"); + if (buffer->flag_ == AVCODEC_BUFFER_FLAG_EOS) { + AVCODEC_LOGI("EOS detected, QueueInputBuffer set eos status."); + codecService_->NotifyEos(); + } + Media::Status ret = implConsumer_->ReleaseBuffer(buffer); return static_cast(ret); } diff --git a/services/services/codec/server/codec_server.cpp b/services/services/codec/server/codec_server.cpp index e2669a263e0eb9f9f609a2efcb255cfcecc5ac75..5245fc4cdd8548ddc6a052f0b038a197d6ad2ca6 100644 --- a/services/services/codec/server/codec_server.cpp +++ b/services/services/codec/server/codec_server.cpp @@ -768,6 +768,8 @@ int32_t CodecServer::SetParameter(const std::shared_ptr ¶meter) { std::lock_guard lock(mutex_); CHECK_AND_RETURN_RET_LOG(parameter != nullptr, AVCS_ERR_NO_MEMORY, "Codecbase is nullptr"); + CHECK_AND_RETURN_RET_LOG(status_ != INITIALIZED && status_ != CONFIGURED, AVCS_ERR_INVALID_STATE, + "In invalid state, %{public}s", GetStatusDescription(status_).data()); return codecBase_->SetParameter(parameter); } int32_t CodecServer::GetOutputFormat(std::shared_ptr ¶meter)