【修改说明】 修改muxer框架代码

Signed-off-by: li-jianchao1993 <lijianchao9@huawei.com>
This commit is contained in:
li-jianchao1993 2023-04-26 02:07:08 +00:00 committed by li-jianchao1993
parent 83f03abd77
commit d3b20d91b9
13 changed files with 82 additions and 85 deletions

View File

@ -33,14 +33,14 @@ namespace Media {
std::shared_ptr<AVMuxer> AVMuxerFactory::CreateAVMuxer(int32_t fd, AVOutputFormat format)
{
AVCodecTrace trace(std::string(__FUNCTION__));
CHECK_AND_RETURN_RET_LOG((fcntl(fd, F_GETFL, 0) & O_RDWR) == O_RDWR, nullptr, "no permission to read and write fd");
CHECK_AND_RETURN_RET_LOG(lseek(fd, 0, SEEK_CUR) != -1, nullptr, "the fd is not seekable");
CHECK_AND_RETURN_RET_LOG((fcntl(fd, F_GETFL, 0) & O_RDWR) == O_RDWR, nullptr, "No permission to read and write fd");
CHECK_AND_RETURN_RET_LOG(lseek(fd, 0, SEEK_CUR) != -1, nullptr, "The fd is not seekable");
std::shared_ptr<AVMuxerImpl> impl = std::make_shared<AVMuxerImpl>(fd, format);
CHECK_AND_RETURN_RET_LOG(impl != nullptr, nullptr, "create avmuxer implementation failed");
CHECK_AND_RETURN_RET_LOG(impl != nullptr, nullptr, "Create avmuxer implementation failed");
int32_t ret = impl->Init();
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, nullptr, "init avmuxer implementation failed");
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, nullptr, "Init avmuxer implementation failed");
return impl;
}
@ -64,7 +64,7 @@ int32_t AVMuxerImpl::Init()
{
AVCodecTrace trace(std::string(__FUNCTION__));
muxerClient_ = AVCodecServiceFactory::GetInstance().CreateMuxerService();
CHECK_AND_RETURN_RET_LOG(muxerClient_ != nullptr, AVCS_ERR_INVALID_OPERATION, "create avmuxer engine failed");
CHECK_AND_RETURN_RET_LOG(muxerClient_ != nullptr, AVCS_ERR_INVALID_OPERATION, "Create avmuxer engine failed");
return AVCS_ERR_OK;
}
@ -110,14 +110,13 @@ int32_t AVMuxerImpl::WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffe
CHECK_AND_RETURN_RET_LOG(sampleBuffer != nullptr && info.offset >= 0 && info.size >= 0,
AVCS_ERR_INVALID_VAL, "Invalid memory");
std::shared_ptr<AVSharedMemoryBase> sharedSampleBuffer =
std::make_shared<AVSharedMemoryBase>(info.size, AVSharedMemory::FLAGS_READ_ONLY, "sampleBuffer");
int32_t ret = sharedSampleBuffer->Init();
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, AVCS_ERR_NO_MEMORY, "create AVSharedMemoryBase failed");
std::shared_ptr<AVSharedMemory> sharedSampleBuffer =
AVSharedMemoryBase::CreateFromLocal(info.size, AVSharedMemory::FLAGS_READ_ONLY, "SampleBuffer");
CHECK_AND_RETURN_RET_LOG(sharedSampleBuffer == nullptr, AVCS_ERR_NO_MEMORY, "Create AVSharedMemoryBase failed");
errno_t rc = memcpy_s(sharedSampleBuffer->GetBase(), sharedSampleBuffer->GetSize(), sampleBuffer + info.offset, info.size);
CHECK_AND_RETURN_RET_LOG(rc == EOK, AVCS_ERR_UNKNOWN, "memcpy_s failed");
return muxerClient_->WriteSampleBuffer(trackIndex, sharedSampleBuffer->GetBase(), info);
return muxerClient_->WriteSampleBuffer(trackIndex, sharedSampleBuffer, info);
}
int32_t AVMuxerImpl::Stop()

View File

@ -19,7 +19,8 @@ public:
virtual int32_t SetParameter(const Format &generalFormat) = 0;
virtual int32_t AddTrack(uint32_t &trackIndex, const Format &trackFormat) = 0;
virtual int32_t Start() = 0;
virtual int32_t WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info) = 0;
virtual int32_t WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer,
AVCodecBufferInfo info) = 0;
virtual int32_t Stop() = 0;
};
} // namespace Media

View File

@ -95,10 +95,10 @@ int32_t AVMuxerClient::Start()
return muxerProxy_->Start();
}
int32_t AVMuxerClient::WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info)
int32_t AVMuxerClient::WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info)
{
std::lock_guard<std::mutex> lock(mutex_);
CHECK_AND_RETURN_RET_LOG(sampleBuffer != nullptr, AVCS_ERR_INVALID_VAL, "sampleBuffer is nullptr");
CHECK_AND_RETURN_RET_LOG(sampleBuffer != nullptr, AVCS_ERR_INVALID_VAL, "SampleBuffer is nullptr");
CHECK_AND_RETURN_RET_LOG(muxerProxy_ != nullptr, AVCS_ERR_NO_MEMORY, "Muxer Service does not exist");
return muxerProxy_->WriteSampleBuffer(trackIndex, sampleBuffer, info);
}

View File

@ -33,7 +33,7 @@ public:
int32_t SetParameter(const Format &generalFormat) override;
int32_t AddTrack(uint32_t &trackIndex, const Format &trackFormat) override;
int32_t Start() override;
int32_t WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info) override;
int32_t WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info) override;
int32_t Stop() override;
void AVCodecServerDied();

View File

@ -44,10 +44,10 @@ int32_t AVMuxerProxy::DestroyStub()
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
int error = Remote()->SendRequest(DESTROY_STUB, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call DestroyStub, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(DESTROY_STUB, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call DestroyStub");
return reply.ReadInt32();
}
@ -58,10 +58,10 @@ int32_t AVMuxerProxy::Init()
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
int error = Remote()->SendRequest(INIT, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call Init, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(INIT, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call Init");
return reply.ReadInt32();
}
@ -72,12 +72,12 @@ int32_t AVMuxerProxy::SetLocation(float latitude, float longitude)
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
data.WriteFloat(latitude);
data.WriteFloat(longitude);
int error = Remote()->SendRequest(SET_LOCATION, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call SetLocation, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(SET_LOCATION, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call SetLocation");
return reply.ReadInt32();
}
@ -88,11 +88,11 @@ int32_t AVMuxerProxy::SetRotation(int32_t rotation)
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
data.WriteInt32(rotation);
int error = Remote()->SendRequest(SET_ROTATION, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call SetRotation, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(SET_ROTATION, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call SetRotation");
return reply.ReadInt32();
}
@ -104,12 +104,11 @@ int32_t AVMuxerProxy::SetParameter(const Format &generalFormat)
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
AVCodecParcel::Marshalling(data, generalFormat);
int32_t ret = Remote()->SendRequest(SET_PARAMETER, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, AVCS_ERR_INVALID_OPERATION,
"SetParameter failed, error: %{public}d", ret);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, AVCS_ERR_INVALID_OPERATION, "SetParameter failed");
return reply.ReadInt32();
}
@ -121,14 +120,13 @@ int32_t AVMuxerProxy::AddTrack(uint32_t &trackIndex, const Format &trackFormat)
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
data.WriteInt32(trackIndex);
AVCodecParcel::Marshalling(data, trackFormat);
int32_t error = Remote()->SendRequest(ADD_TRACK, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call AddTrack, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(ADD_TRACK, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call AddTrack");
// int32_t trackId = reply.ReadInt32();
return reply.ReadInt32();
}
@ -139,17 +137,14 @@ int32_t AVMuxerProxy::Start()
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor");
int32_t error = Remote()->SendRequest(START, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call Start, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(START, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call Start");
return reply.ReadInt32();
}
int32_t AVMuxerProxy::WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info)
int32_t AVMuxerProxy::WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info)
{
CHECK_AND_RETURN_RET_LOG(sampleBuffer != nullptr, AVCS_ERR_INVALID_VAL, "sampleBuffer is nullptr");
MessageParcel data;
@ -157,11 +152,15 @@ int32_t AVMuxerProxy::WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuff
MessageOption option;
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
data.WriteInt32(trackIndex);
WriteAVSharedMemoryToParcel(sampleBuffer, data);
data.WriteInt64(info.presentationTimeUs);
data.WriteInt32(info.size);
data.WriteInt32(info.offset);
// data.WriteInt32(info.flag);
int32_t error = Remote()->SendRequest(WRITE_SAMPLE_BUFFER, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call WriteTrackSample, error: %{public}d", error);
int32_t ret = Remote()->SendRequest(WRITE_SAMPLE_BUFFER, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call WriteTrackSample");
return reply.ReadInt32();
}
@ -174,8 +173,8 @@ int32_t AVMuxerProxy::Stop()
bool token = data.WriteInterfaceToken(AVMuxerProxy::GetDescriptor());
CHECK_AND_RETURN_RET_LOG(token, AVCS_ERR_INVALID_OPERATION, "Failed to write descriptor!");
int error = Remote()->SendRequest(STOP, data, reply, option);
CHECK_AND_RETURN_RET_LOG(error == AVCS_ERR_OK, error, "Failed to call Stop, error: %{public}d", error);
int ret = Remote()->SendRequest(STOP, data, reply, option);
CHECK_AND_RETURN_RET_LOG(ret == AVCS_ERR_OK, ret, "Failed to call Stop");
return reply.ReadInt32();
}
} // namespace Media

View File

@ -134,7 +134,7 @@ int32_t AVMuxerStub::Start()
return muxerServer_->Start();
}
int32_t AVMuxerStub::WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info)
int32_t AVMuxerStub::WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info)
{
CHECK_AND_RETURN_RET_LOG(muxerServer_ != nullptr, AVCS_ERR_NO_MEMORY, "muxer service is nullptr");
return muxerServer_->WriteSampleBuffer(trackIndex, sampleBuffer, info);
@ -162,14 +162,16 @@ int32_t AVMuxerStub::Init(MessageParcel &data, MessageParcel &reply)
// TODO: 补充LOG说明
(void)data;
(void)reply;
bool ret = reply.WriteInt32(Init());
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
int32_t AVMuxerStub::DestroyStub(MessageParcel &data, MessageParcel &reply)
{
(void)data;
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(DestroyStub()), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(DestroyStub());
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
@ -177,18 +179,16 @@ int32_t AVMuxerStub::SetLocation(MessageParcel &data, MessageParcel &reply)
{
float latitude = data.ReadFloat();
float longitude = data.ReadFloat();
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(SetLocation(latitude, longitude)), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(SetLocation(latitude, longitude));
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
int32_t AVMuxerStub::SetRotation(MessageParcel &data, MessageParcel &reply)
{
int32_t rotation = data.ReadInt32();
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(SetRotation(rotation)), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(SetRotation(rotation));
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
@ -196,29 +196,26 @@ int32_t AVMuxerStub::SetParameter(MessageParcel &data, MessageParcel &reply)
{
Format format;
AVCodecParcel::Unmarshalling(data, format);
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(SetParameter(format)), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(SetParameter(format));
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
int32_t AVMuxerStub::AddTrack(MessageParcel &data, MessageParcel &reply)
{
Format generalFormat;
uint32_t trackIndex = data.ReadInt32();
(void)AVCodecParcel::Unmarshalling(data, generalFormat);
// TODO:
uint32_t trackIndex = 0;
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(AddTrack(trackIndex, generalFormat)), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(AddTrack(trackIndex, generalFormat));
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
int32_t AVMuxerStub::Start(MessageParcel &data, MessageParcel &reply)
{
(void)data;
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(Start()), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(Start());
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
@ -226,15 +223,22 @@ int32_t AVMuxerStub::WriteSampleBuffer(MessageParcel &data, MessageParcel &reply
{
(void)data;
(void)reply;
uint32_t trackIndex = data.ReadInt32();
std::shared_ptr<AVSharedMemory> sampleBuffer = ReadAVSharedMemoryFromParcel(data);
AVCodecBufferInfo bufferInfo;
bufferInfo.presentationTimeUs = data.ReadInt64();
bufferInfo.size = data.ReadInt32();
bufferInfo.offset = data.ReadInt32();
bool ret = reply.WriteInt32(WriteSampleBuffer(trackIndex, sampleBuffer, bufferInfo));
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}
int32_t AVMuxerStub::Stop(MessageParcel &data, MessageParcel &reply)
{
(void)data;
// TODO: 补充LOG说明
CHECK_AND_RETURN_RET_LOG(reply.WriteInt32(Stop()), AVCS_ERR_UNKNOWN, "");
bool ret = reply.WriteInt32(Stop());
CHECK_AND_RETURN_RET_LOG(ret, AVCS_ERR_INVALID_OPERATION, "MessageParcel write failed");
return AVCS_ERR_OK;
}

View File

@ -31,7 +31,7 @@ public:
int32_t SetParameter(const Format &generalFormat) override;
int32_t AddTrack(uint32_t &trackIndex, const Format &trackFormat) override;
int32_t Start() override;
int32_t WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info) override;
int32_t WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info) override;
int32_t Stop() override;
int32_t DestroyStub() override;

View File

@ -36,7 +36,7 @@ public:
int32_t SetParameter(const Format &generalFormat) override;
int32_t AddTrack(uint32_t &trackIndex, const Format &trackFormat) override;
int32_t Start() override;
int32_t WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info) override;
int32_t WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info) override;
int32_t Stop() override;
int32_t DumpInfo(int32_t fd);

View File

@ -32,7 +32,7 @@ public:
virtual int32_t SetParameter(const Format &generalFormat) = 0;
virtual int32_t AddTrack(uint32_t &trackIndex, const Format &trackFormat) = 0;
virtual int32_t Start() = 0;
virtual int32_t WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info) = 0;
virtual int32_t WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info) = 0;
virtual int32_t Stop() = 0;
virtual int32_t DestroyStub() = 0;
@ -45,7 +45,6 @@ public:
START,
WRITE_SAMPLE_BUFFER,
STOP,
DESTROY_STUB,
};

View File

@ -40,15 +40,11 @@ AVMuxerServer::AVMuxerServer()
AVMuxerServer::~AVMuxerServer()
{
AVCODEC_LOGD("0x%{public}06" PRIXPTR " Instances destroy", FAKE_POINTER(this));
std::lock_guard<std::mutex> lock(mutex_);
// avmuxerEngine_ = nullptr;
}
int32_t AVMuxerServer::InitServer()
{
return AVCS_ERR_OK;
}
@ -67,7 +63,6 @@ int32_t AVMuxerServer::SetLocation(float latitude, float longitude)
(void)longitude;
std::lock_guard<std::mutex> lock(mutex_);
return AVCS_ERR_OK;
}
@ -106,7 +101,7 @@ int32_t AVMuxerServer::Start()
return AVCS_ERR_OK;
}
int32_t AVMuxerServer::WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info)
int32_t AVMuxerServer::WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info)
{
// TODO:achieve it
(void)trackIndex;

View File

@ -34,7 +34,7 @@ public:
int32_t SetParameter(const Format &generalFormat) override;
int32_t AddTrack(uint32_t &trackIndex, const Format &trackFormat) override;
int32_t Start() override;
int32_t WriteSampleBuffer(uint32_t trackIndex, uint8_t *sampleBuffer, AVCodecBufferInfo info) override;
int32_t WriteSampleBuffer(uint32_t trackIndex, const std::shared_ptr<AVSharedMemory> &sampleBuffer, AVCodecBufferInfo info) override;
int32_t Stop() override;
private:

View File

@ -175,13 +175,13 @@ std::shared_ptr<IAVMuxer> AVCodecClient::CreateMuxerService()
sptr<IRemoteObject> object = avCodecProxy_->GetSubSystemAbility(
IStandardAVCodecService::AVCodecSystemAbility::AVCODEC_MUXER, listenerStub_->AsObject());
CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "muxer proxy object is nullptr.");
CHECK_AND_RETURN_RET_LOG(object != nullptr, nullptr, "Muxer proxy object is nullptr.");
sptr<IAVMuxerService> muxerProxy = iface_cast<IAVMuxerService>(object);
CHECK_AND_RETURN_RET_LOG(muxerProxy != nullptr, nullptr, "muxer proxy is nullptr.");
CHECK_AND_RETURN_RET_LOG(muxerProxy != nullptr, nullptr, "Muxer proxy is nullptr.");
std::shared_ptr<AVMuxerClient> muxerClient = AVMuxerClient::Create(muxerProxy);
CHECK_AND_RETURN_RET_LOG(muxerClient != nullptr, nullptr, "failed to create muxer client.");
CHECK_AND_RETURN_RET_LOG(muxerClient != nullptr, nullptr, "Failed to create muxer client.");
muxerClientList_.push_back(muxerClient);
return muxerClient;

View File

@ -287,7 +287,7 @@ sptr<IRemoteObject> AVCodecServerManager::CreateMuxerStubObject()
}
sptr<AVMuxerStub> stub = AVMuxerStub::Create();
if (stub == nullptr) {
AVCODEC_LOGE("failed to create AVMuxerStub");
AVCODEC_LOGE("Failed to create AVMuxerStub");
return nullptr;
}
sptr<IRemoteObject> object = stub->AsObject();
@ -305,7 +305,7 @@ sptr<IRemoteObject> AVCodecServerManager::CreateMuxerStubObject()
dumperTbl_[StubType::MUXER].emplace_back(dumper);
AVCODEC_LOGD("The number of muxer services(%{public}zu).", muxerStubMap_.size());
if (Dump(-1, std::vector<std::u16string>()) != OHOS::NO_ERROR) {
AVCODEC_LOGW("failed to call InstanceDump");
AVCODEC_LOGW("Failed to call InstanceDump");
}
}
return object;