Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/gmp/PGMPVideoEncoderParent.h"
#include "GMPMessageUtils.h"
#include "GMPVideoEncoderChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/gmp/PGMPContentParent.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
namespace mozilla {
namespace gmp {
auto PGMPVideoEncoderParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PGMPVideoEncoderParent::PGMPVideoEncoderParent() :
mozilla::ipc::IRefCountedProtocol(PGMPVideoEncoderMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PGMPVideoEncoderParent);
}
PGMPVideoEncoderParent::~PGMPVideoEncoderParent()
{
MOZ_COUNT_DTOR(PGMPVideoEncoderParent);
}
auto PGMPVideoEncoderParent::ActorAlloc() -> void
{
AddRef();
}
auto PGMPVideoEncoderParent::ActorDealloc() -> void
{
Release();
}
auto PGMPVideoEncoderParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PGMPVideoEncoderParent::Manager() const -> PGMPContentParent*
{
return static_cast<PGMPContentParent*>(IProtocol::Manager());
}
auto PGMPVideoEncoderParent::AllManagedActors(nsTArray<RefPtr<mozilla::ipc::ActorLifecycleProxy>>& arr__) const -> void
{
uint32_t total = 0;
arr__.SetCapacity(total);
}
auto PGMPVideoEncoderParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PGMPVideoEncoderParent::SendInitEncode(
const GMPVideoCodec& aCodecSettings,
mozilla::Span<uint8_t const> aCodecSpecific,
const int32_t& aNumberOfCores,
const uint32_t& aMaxPayloadSize) -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_InitEncode(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aCodecSettings);
// Sentinel = 'aCodecSettings'
((&(writer__)))->WriteSentinel(674629009);
IPC::WriteParam((&(writer__)), aCodecSpecific);
// Sentinel = 'aCodecSpecific'
((&(writer__)))->WriteSentinel(665847142);
IPC::WriteParam((&(writer__)), aNumberOfCores);
// Sentinel = 'aNumberOfCores'
((&(writer__)))->WriteSentinel(681117052);
IPC::WriteParam((&(writer__)), aMaxPayloadSize);
// Sentinel = 'aMaxPayloadSize'
((&(writer__)))->WriteSentinel(780076525);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_InitEncode", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::SendEncode(
const GMPVideoi420FrameData& aInputFrame,
mozilla::Span<uint8_t const> aCodecSpecificInfo,
mozilla::Span<GMPVideoFrameType const> aFrameTypes) -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_Encode(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aInputFrame);
// Sentinel = 'aInputFrame'
((&(writer__)))->WriteSentinel(434177117);
IPC::WriteParam((&(writer__)), aCodecSpecificInfo);
// Sentinel = 'aCodecSpecificInfo'
((&(writer__)))->WriteSentinel(1089537778);
IPC::WriteParam((&(writer__)), aFrameTypes);
// Sentinel = 'aFrameTypes'
((&(writer__)))->WriteSentinel(426378338);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_Encode", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::SendSetChannelParameters(
const uint32_t& aPacketLoss,
const uint32_t& aRTT) -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_SetChannelParameters(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aPacketLoss);
// Sentinel = 'aPacketLoss'
((&(writer__)))->WriteSentinel(423363675);
IPC::WriteParam((&(writer__)), aRTT);
// Sentinel = 'aRTT'
((&(writer__)))->WriteSentinel(58327388);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_SetChannelParameters", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::SendSetRates(
const uint32_t& aNewBitRate,
const uint32_t& aFrameRate) -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_SetRates(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aNewBitRate);
// Sentinel = 'aNewBitRate'
((&(writer__)))->WriteSentinel(415695927);
IPC::WriteParam((&(writer__)), aFrameRate);
// Sentinel = 'aFrameRate'
((&(writer__)))->WriteSentinel(348128217);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_SetRates", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::SendSetPeriodicKeyFrames(const bool& aEnable) -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_SetPeriodicKeyFrames(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aEnable);
// Sentinel = 'aEnable'
((&(writer__)))->WriteSentinel(173605545);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_SetPeriodicKeyFrames", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::SendEncodingComplete() -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_EncodingComplete(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_EncodingComplete", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::SendChildShmemForPool(Shmem&& aEncodedBuffer) -> bool
{
UniquePtr<IPC::Message> msg__ = PGMPVideoEncoder::Msg_ChildShmemForPool(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), std::move(aEncodedBuffer));
// Sentinel = 'aEncodedBuffer'
((&(writer__)))->WriteSentinel(668927342);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_ChildShmemForPool", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PGMPVideoEncoderParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PGMPVideoEncoderParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PGMPVideoEncoderParent::OnMessageReceived(const Message& msg__) -> PGMPVideoEncoderParent::Result
{
switch (msg__.type()) {
case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
return MsgProcessed;
}
case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
IProtocol* mgr = this->Manager();
this->DestroySubtree(ManagedEndpointDropped);
this->ClearSubtree();
mgr->RemoveManagee(PGMPVideoEncoderMsgStart, this);
return MsgProcessed;
}
case PGMPVideoEncoder::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg___delete__", OTHER);
mozilla::ipc::IPCResult __ok = (this)->Recv__delete__();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
IProtocol* mgr = this->Manager();
this->DestroySubtree(Deletion);
this->ClearSubtree();
mgr->RemoveManagee(PGMPVideoEncoderMsgStart, this);
return MsgProcessed;
}
case PGMPVideoEncoder::Msg_Encoded__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_Encoded", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aEncodedFrame = IPC::ReadParam<GMPVideoEncodedFrameData>((&(reader__)));
if (!maybe__aEncodedFrame) {
FatalError("Error deserializing 'GMPVideoEncodedFrameData'");
return MsgValueError;
}
auto& aEncodedFrame = *maybe__aEncodedFrame;
// Sentinel = 'aEncodedFrame'
if ((!(((&(reader__)))->ReadSentinel(578290943)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'GMPVideoEncodedFrameData'");
return MsgValueError;
}
auto maybe__aCodecSpecificInfo = IPC::ReadParam<nsTArray<uint8_t>>((&(reader__)));
if (!maybe__aCodecSpecificInfo) {
FatalError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
auto& aCodecSpecificInfo = *maybe__aCodecSpecificInfo;
// Sentinel = 'aCodecSpecificInfo'
if ((!(((&(reader__)))->ReadSentinel(1089537778)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint8_t[]'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (this)->RecvEncoded(std::move(aEncodedFrame), std::move(aCodecSpecificInfo));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PGMPVideoEncoder::Msg_Error__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_Error", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aErr = IPC::ReadParam<GMPErr>((&(reader__)));
if (!maybe__aErr) {
FatalError("Error deserializing 'GMPErr'");
return MsgValueError;
}
auto& aErr = *maybe__aErr;
// Sentinel = 'aErr'
if ((!(((&(reader__)))->ReadSentinel(61669771)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'GMPErr'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (this)->RecvError(std::move(aErr));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PGMPVideoEncoder::Msg_Shutdown__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_Shutdown", OTHER);
mozilla::ipc::IPCResult __ok = (this)->RecvShutdown();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PGMPVideoEncoder::Msg_ParentShmemForPool__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_ParentShmemForPool", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aFrameBuffer = IPC::ReadParam<Shmem>((&(reader__)));
if (!maybe__aFrameBuffer) {
FatalError("Error deserializing 'Shmem'");
return MsgValueError;
}
auto& aFrameBuffer = *maybe__aFrameBuffer;
// Sentinel = 'aFrameBuffer'
if ((!(((&(reader__)))->ReadSentinel(494732455)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Shmem'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (this)->RecvParentShmemForPool(std::move(aFrameBuffer));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PGMPVideoEncoderParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PGMPVideoEncoderParent::Result
{
switch (msg__.type()) {
case PGMPVideoEncoder::Msg_NeedShmem__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PGMPVideoEncoder::Msg_NeedShmem", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__aEncodedBufferSize = IPC::ReadParam<uint32_t>((&(reader__)));
if (!maybe__aEncodedBufferSize) {
FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& aEncodedBufferSize = *maybe__aEncodedBufferSize;
// Sentinel = 'aEncodedBufferSize'
if ((!(((&(reader__)))->ReadSentinel(1098319625)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
reader__.EndRead();
int32_t id__ = Id();
Shmem aMem{};
mozilla::ipc::IPCResult __ok = (this)->RecvNeedShmem(std::move(aEncodedBufferSize), (&(aMem)));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
reply__ = PGMPVideoEncoder::Reply_NeedShmem(id__);
IPC::MessageWriter writer__{
(*(reply__)),
this};
IPC::WriteParam((&(writer__)), std::move(aMem));
// Sentinel = 'aMem'
((&(writer__)))->WriteSentinel(61211009);
if (mozilla::ipc::LoggingEnabledFor("PGMPVideoEncoder", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PGMPVideoEncoderParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PGMPVideoEncoderParent::ClearSubtree() -> void
{
}
} // namespace gmp
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::gmp::PGMPVideoEncoderParent*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
MOZ_RELEASE_ASSERT(
aWriter->GetActor(),
"Cannot serialize managed actors without an actor");
int32_t id;
if (!aVar) {
id = 0; // kNullActorId
} else {
id = aVar->Id();
if (id == 1) { // kFreedActorId
aVar->FatalError("Actor has been |delete|d");
}
MOZ_RELEASE_ASSERT(
aWriter->GetActor()->GetIPCChannel() == aVar->GetIPCChannel(),
"Actor must be from the same channel as the"
" actor it's being sent over");
MOZ_RELEASE_ASSERT(
aVar->CanSend(),
"Actor must still be open when sending");
}
IPC::WriteParam(aWriter, id);
}
auto ParamTraits<::mozilla::gmp::PGMPVideoEncoderParent*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
MOZ_RELEASE_ASSERT(
aReader->GetActor(),
"Cannot deserialize managed actors without an actor");
mozilla::Maybe<mozilla::ipc::IProtocol*> actor = aReader->GetActor()
->ReadActor(aReader, true, "PGMPVideoEncoder", PGMPVideoEncoderMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::gmp::PGMPVideoEncoderParent*>(actor.ref());
}
return {};
}
} // namespace IPC