mirror of
https://gitee.com/openharmony/multimedia_av_codec
synced 2025-03-01 15:46:55 +00:00
解决getoutputdescription eos后无法获取问题
Signed-off-by: guoyao <guoyao18@huawei.com>
This commit is contained in:
parent
f42cc8da46
commit
d98a738da7
@ -207,8 +207,8 @@ int32_t AVCodecAudioCodecImpl::QueueInputBuffer(uint32_t index)
|
||||
inputBufferObjMap_.erase(index);
|
||||
}
|
||||
CHECK_AND_RETURN_RET_LOG(buffer != nullptr, AVCS_ERR_INVALID_STATE, "buffer not found");
|
||||
mediaCodecProducer_->PushBuffer(buffer, true);
|
||||
return AVCS_ERR_OK;
|
||||
Media::Status ret = mediaCodecProducer_->PushBuffer(buffer, true);
|
||||
return StatusToAVCodecServiceErrCode(ret);
|
||||
}
|
||||
|
||||
int32_t AVCodecAudioCodecImpl::GetOutputFormat(Format &format)
|
||||
@ -216,9 +216,10 @@ int32_t AVCodecAudioCodecImpl::GetOutputFormat(Format &format)
|
||||
AVCODEC_SYNC_TRACE;
|
||||
CHECK_AND_RETURN_RET_LOG(codecService_ != nullptr, AVCS_ERR_INVALID_STATE, "service died");
|
||||
std::shared_ptr<Media::Meta> parameter = std::make_shared<Media::Meta>();
|
||||
codecService_->GetOutputFormat(parameter);
|
||||
int32_t ret = codecService_->GetOutputFormat(parameter);
|
||||
CHECK_AND_RETURN_RET_LOG(ret == 0, ret, "GetOutputFormat fail, ret:%{public}d", ret);
|
||||
format.SetMeta(parameter);
|
||||
return AVCS_ERR_OK;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t AVCodecAudioCodecImpl::ReleaseOutputBuffer(uint32_t index)
|
||||
@ -241,7 +242,7 @@ int32_t AVCodecAudioCodecImpl::ReleaseOutputBuffer(uint32_t index)
|
||||
}
|
||||
|
||||
Media::Status ret = implConsumer_->ReleaseBuffer(buffer);
|
||||
return static_cast<int32_t>(ret);
|
||||
return StatusToAVCodecServiceErrCode(ret);
|
||||
}
|
||||
|
||||
int32_t AVCodecAudioCodecImpl::SetParameter(const Format &format)
|
||||
|
@ -290,8 +290,8 @@ int32_t MediaCodec::SetParameter(const std::shared_ptr<Meta> ¶meter)
|
||||
int32_t MediaCodec::GetOutputFormat(std::shared_ptr<Meta> ¶meter)
|
||||
{
|
||||
AutoLock lock(stateMutex_);
|
||||
FALSE_RETURN_V(state_ == CodecState::PREPARED || state_ == CodecState::CONFIGURED || state_ == CodecState::RUNNING,
|
||||
(int32_t)Status::ERROR_INVALID_STATE);
|
||||
FALSE_RETURN_V_MSG_E(state_ != CodecState::UNINITIALIZED, (int32_t)Status::ERROR_INVALID_STATE,
|
||||
"status incorrect,get output format failed.");
|
||||
FALSE_RETURN_V(codecPlugin_ != nullptr, (int32_t)Status::ERROR_INVALID_STATE);
|
||||
FALSE_RETURN_V(parameter != nullptr, (int32_t)Status::ERROR_INVALID_PARAMETER);
|
||||
auto ret = codecPlugin_->GetParameter(parameter);
|
||||
|
@ -775,8 +775,9 @@ int32_t CodecServer::SetParameter(const std::shared_ptr<Media::Meta> ¶meter)
|
||||
int32_t CodecServer::GetOutputFormat(std::shared_ptr<Media::Meta> ¶meter)
|
||||
{
|
||||
std::lock_guard<std::shared_mutex> lock(mutex_);
|
||||
CHECK_AND_RETURN_RET_LOG(status_ != UNINITIALIZED, AVCS_ERR_INVALID_STATE, "In invalid state, %{public}s",
|
||||
GetStatusDescription(status_).data());
|
||||
CHECK_AND_RETURN_RET_LOG(codecBase_ != nullptr, AVCS_ERR_NO_MEMORY, "codecBase is nullptr");
|
||||
CHECK_AND_RETURN_RET_LOG(parameter != nullptr, AVCS_ERR_NO_MEMORY, "parameter is nullptr");
|
||||
return codecBase_->GetOutputFormat(parameter);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user