зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1623651 - Update enums that have changed with CDM header bump. r=alwu,dminor
The CDM header bump has moved some enums, as well as using enum classes instead of old style enums. This patch updates consumers of these enums to be compatible with the new headers. Drive by remove `using namespace cdm` from a couple of files as - In some places I'd already been using fully qualified names. - I prefer the fully qualified names as they make it clear when enums are coming from the cdm namespace and `cdm::` is not a particularly more verbose thing to have on identifiers. Differential Revision: https://phabricator.services.mozilla.com/D78343
This commit is contained in:
Родитель
6b306da146
Коммит
defad44097
|
@ -445,7 +445,7 @@ mozilla::ipc::IPCResult ChromiumCDMChild::RecvCreateSessionAndGenerateRequest(
|
|||
"pid=%" PRIu32 ", sessionType=%" PRIu32 ", initDataType=%" PRIu32
|
||||
") initDataLen=%zu",
|
||||
aPromiseId, aSessionType, aInitDataType, aInitData.Length());
|
||||
MOZ_ASSERT(aSessionType <= cdm::SessionType::kPersistentKeyRelease);
|
||||
MOZ_ASSERT(aSessionType <= cdm::SessionType::kPersistentUsageRecord);
|
||||
MOZ_ASSERT(aInitDataType <= cdm::InitDataType::kWebM);
|
||||
if (mCDM) {
|
||||
mCDM->CreateSessionAndGenerateRequest(
|
||||
|
@ -773,12 +773,12 @@ void ChromiumCDMChild::ReturnOutput(WidevineVideoFrame& aFrame) {
|
|||
output.mFormat() = static_cast<cdm::VideoFormat>(aFrame.Format());
|
||||
output.mImageWidth() = aFrame.Size().width;
|
||||
output.mImageHeight() = aFrame.Size().height;
|
||||
output.mYPlane() = {aFrame.PlaneOffset(cdm::VideoFrame::kYPlane),
|
||||
aFrame.Stride(cdm::VideoFrame::kYPlane)};
|
||||
output.mUPlane() = {aFrame.PlaneOffset(cdm::VideoFrame::kUPlane),
|
||||
aFrame.Stride(cdm::VideoFrame::kUPlane)};
|
||||
output.mVPlane() = {aFrame.PlaneOffset(cdm::VideoFrame::kVPlane),
|
||||
aFrame.Stride(cdm::VideoFrame::kVPlane)};
|
||||
output.mYPlane() = {aFrame.PlaneOffset(cdm::VideoPlane::kYPlane),
|
||||
aFrame.Stride(cdm::VideoPlane::kYPlane)};
|
||||
output.mUPlane() = {aFrame.PlaneOffset(cdm::VideoPlane::kUPlane),
|
||||
aFrame.Stride(cdm::VideoPlane::kUPlane)};
|
||||
output.mVPlane() = {aFrame.PlaneOffset(cdm::VideoPlane::kVPlane),
|
||||
aFrame.Stride(cdm::VideoPlane::kVPlane)};
|
||||
output.mTimestamp() = aFrame.Timestamp();
|
||||
|
||||
uint64_t duration = 0;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include "gmp-api/gmp-platform.h"
|
||||
|
||||
using namespace cdm;
|
||||
|
||||
// Declared in ChromiumCDMAdapter.cpp.
|
||||
extern const GMPPlatformAPI* sPlatform;
|
||||
|
||||
|
@ -25,13 +23,13 @@ void WidevineFileIO::Open(const char* aFilename, uint32_t aFilenameLength) {
|
|||
if (GMP_FAILED(err)) {
|
||||
GMP_LOG_DEBUG("WidevineFileIO::Open() '%s' GMPCreateRecord failed",
|
||||
mName.c_str());
|
||||
mClient->OnOpenComplete(FileIOClient::kError);
|
||||
mClient->OnOpenComplete(cdm::FileIOClient::Status::kError);
|
||||
return;
|
||||
}
|
||||
if (GMP_FAILED(record->Open())) {
|
||||
GMP_LOG_DEBUG("WidevineFileIO::Open() '%s' record open failed",
|
||||
mName.c_str());
|
||||
mClient->OnOpenComplete(FileIOClient::kError);
|
||||
mClient->OnOpenComplete(cdm::FileIOClient::Status::kError);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -43,7 +41,7 @@ void WidevineFileIO::Read() {
|
|||
if (!mRecord) {
|
||||
GMP_LOG_DEBUG("WidevineFileIO::Read() '%s' used uninitialized!",
|
||||
mName.c_str());
|
||||
mClient->OnReadComplete(FileIOClient::kError, nullptr, 0);
|
||||
mClient->OnReadComplete(cdm::FileIOClient::Status::kError, nullptr, 0);
|
||||
return;
|
||||
}
|
||||
GMP_LOG_DEBUG("WidevineFileIO::Read() '%s'", mName.c_str());
|
||||
|
@ -54,7 +52,7 @@ void WidevineFileIO::Write(const uint8_t* aData, uint32_t aDataSize) {
|
|||
if (!mRecord) {
|
||||
GMP_LOG_DEBUG("WidevineFileIO::Write() '%s' used uninitialized!",
|
||||
mName.c_str());
|
||||
mClient->OnWriteComplete(FileIOClient::kError);
|
||||
mClient->OnWriteComplete(cdm::FileIOClient::Status::kError);
|
||||
return;
|
||||
}
|
||||
mRecord->Write(aData, aDataSize);
|
||||
|
@ -69,14 +67,14 @@ void WidevineFileIO::Close() {
|
|||
delete this;
|
||||
}
|
||||
|
||||
static FileIOClient::Status GMPToWidevineFileStatus(GMPErr aStatus) {
|
||||
static cdm::FileIOClient::Status GMPToWidevineFileStatus(GMPErr aStatus) {
|
||||
switch (aStatus) {
|
||||
case GMPRecordInUse:
|
||||
return FileIOClient::kInUse;
|
||||
return cdm::FileIOClient::Status::kInUse;
|
||||
case GMPNoErr:
|
||||
return FileIOClient::kSuccess;
|
||||
return cdm::FileIOClient::Status::kSuccess;
|
||||
default:
|
||||
return FileIOClient::kError;
|
||||
return cdm::FileIOClient::Status::kError;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,12 +9,10 @@
|
|||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/IntegerPrintfMacros.h"
|
||||
|
||||
using namespace cdm;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
WidevineVideoFrame::WidevineVideoFrame()
|
||||
: mFormat(kUnknownVideoFormat),
|
||||
: mFormat(cdm::VideoFormat::kUnknownVideoFormat),
|
||||
mSize{0, 0},
|
||||
mBuffer(nullptr),
|
||||
mTimestamp(0) {
|
||||
|
@ -70,25 +68,24 @@ void WidevineVideoFrame::SetFrameBuffer(cdm::Buffer* aFrameBuffer) {
|
|||
|
||||
cdm::Buffer* WidevineVideoFrame::FrameBuffer() { return mBuffer; }
|
||||
|
||||
void WidevineVideoFrame::SetPlaneOffset(cdm::VideoFrame::VideoPlane aPlane,
|
||||
void WidevineVideoFrame::SetPlaneOffset(cdm::VideoPlane aPlane,
|
||||
uint32_t aOffset) {
|
||||
GMP_LOG_DEBUG("WidevineVideoFrame::SetPlaneOffset(%d, %" PRIu32 ") this=%p",
|
||||
aPlane, aOffset, this);
|
||||
mPlaneOffsets[aPlane] = aOffset;
|
||||
}
|
||||
|
||||
uint32_t WidevineVideoFrame::PlaneOffset(cdm::VideoFrame::VideoPlane aPlane) {
|
||||
uint32_t WidevineVideoFrame::PlaneOffset(cdm::VideoPlane aPlane) {
|
||||
return mPlaneOffsets[aPlane];
|
||||
}
|
||||
|
||||
void WidevineVideoFrame::SetStride(cdm::VideoFrame::VideoPlane aPlane,
|
||||
uint32_t aStride) {
|
||||
void WidevineVideoFrame::SetStride(cdm::VideoPlane aPlane, uint32_t aStride) {
|
||||
GMP_LOG_DEBUG("WidevineVideoFrame::SetStride(%d, %" PRIu32 ") this=%p",
|
||||
aPlane, aStride, this);
|
||||
mPlaneStrides[aPlane] = aStride;
|
||||
}
|
||||
|
||||
uint32_t WidevineVideoFrame::Stride(cdm::VideoFrame::VideoPlane aPlane) {
|
||||
uint32_t WidevineVideoFrame::Stride(cdm::VideoPlane aPlane) {
|
||||
return mPlaneStrides[aPlane];
|
||||
}
|
||||
|
||||
|
@ -121,17 +118,17 @@ bool WidevineVideoFrame::InitToBlack(int32_t aWidth, int32_t aHeight,
|
|||
mBuffer->Destroy();
|
||||
mBuffer = nullptr;
|
||||
}
|
||||
SetFormat(VideoFormat::kI420);
|
||||
SetFormat(cdm::VideoFormat::kI420);
|
||||
SetSize(cdm::Size{aWidth, aHeight});
|
||||
SetFrameBuffer(buffer);
|
||||
SetPlaneOffset(VideoFrame::kYPlane, 0);
|
||||
SetStride(VideoFrame::kYPlane, aWidth);
|
||||
SetPlaneOffset(cdm::VideoPlane::kYPlane, 0);
|
||||
SetStride(cdm::VideoPlane::kYPlane, aWidth);
|
||||
// Note: U and V planes are stored at the same place in order to
|
||||
// save memory since their contents are the same.
|
||||
SetPlaneOffset(VideoFrame::kUPlane, ySize);
|
||||
SetStride(VideoFrame::kUPlane, (aWidth + 1) / 2);
|
||||
SetPlaneOffset(VideoFrame::kVPlane, ySize);
|
||||
SetStride(VideoFrame::kVPlane, (aWidth + 1) / 2);
|
||||
SetPlaneOffset(cdm::VideoPlane::kUPlane, ySize);
|
||||
SetStride(cdm::VideoPlane::kUPlane, (aWidth + 1) / 2);
|
||||
SetPlaneOffset(cdm::VideoPlane::kVPlane, ySize);
|
||||
SetStride(cdm::VideoPlane::kVPlane, (aWidth + 1) / 2);
|
||||
SetTimestamp(aTimeStamp);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,12 +28,11 @@ class WidevineVideoFrame : public cdm::VideoFrame {
|
|||
void SetFrameBuffer(cdm::Buffer* aFrameBuffer) override;
|
||||
cdm::Buffer* FrameBuffer() override;
|
||||
|
||||
void SetPlaneOffset(cdm::VideoFrame::VideoPlane aPlane,
|
||||
uint32_t aOffset) override;
|
||||
uint32_t PlaneOffset(cdm::VideoFrame::VideoPlane aPlane) override;
|
||||
void SetPlaneOffset(cdm::VideoPlane aPlane, uint32_t aOffset) override;
|
||||
uint32_t PlaneOffset(cdm::VideoPlane aPlane) override;
|
||||
|
||||
void SetStride(cdm::VideoFrame::VideoPlane aPlane, uint32_t aStride) override;
|
||||
uint32_t Stride(cdm::VideoFrame::VideoPlane aPlane) override;
|
||||
void SetStride(cdm::VideoPlane aPlane, uint32_t aStride) override;
|
||||
uint32_t Stride(cdm::VideoPlane aPlane) override;
|
||||
|
||||
void SetTimestamp(int64_t aTimestamp) override;
|
||||
int64_t Timestamp() const override;
|
||||
|
@ -45,8 +44,8 @@ class WidevineVideoFrame : public cdm::VideoFrame {
|
|||
cdm::VideoFormat mFormat;
|
||||
cdm::Size mSize;
|
||||
cdm::Buffer* mBuffer;
|
||||
uint32_t mPlaneOffsets[kMaxPlanes];
|
||||
uint32_t mPlaneStrides[kMaxPlanes];
|
||||
uint32_t mPlaneOffsets[cdm::VideoPlane::kMaxPlanes];
|
||||
uint32_t mPlaneStrides[cdm::VideoPlane::kMaxPlanes];
|
||||
int64_t mTimestamp;
|
||||
};
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
#include "mozilla/CheckedInt.h"
|
||||
|
||||
using namespace wmf;
|
||||
using namespace cdm;
|
||||
|
||||
VideoDecoder::VideoDecoder(Host_10* aHost) : mHost(aHost), mHasShutdown(false) {
|
||||
VideoDecoder::VideoDecoder(cdm::Host_10* aHost)
|
||||
: mHost(aHost), mHasShutdown(false) {
|
||||
CK_LOGD("VideoDecoder created");
|
||||
|
||||
// We drop the ref in DecodingComplete().
|
||||
|
@ -45,20 +45,20 @@ VideoDecoder::VideoDecoder(Host_10* aHost) : mHost(aHost), mHasShutdown(false) {
|
|||
|
||||
VideoDecoder::~VideoDecoder() { CK_LOGD("VideoDecoder destroyed"); }
|
||||
|
||||
Status VideoDecoder::InitDecode(const VideoDecoderConfig_2& aConfig) {
|
||||
cdm::Status VideoDecoder::InitDecode(const cdm::VideoDecoderConfig_2& aConfig) {
|
||||
CK_LOGD("VideoDecoder::InitDecode");
|
||||
|
||||
if (!mDecoder) {
|
||||
CK_LOGD("VideoDecoder::InitDecode failed to init WMFH264Decoder");
|
||||
|
||||
return Status::kDecodeError;
|
||||
return cdm::Status::kDecodeError;
|
||||
}
|
||||
|
||||
return Status::kSuccess;
|
||||
return cdm::Status::kSuccess;
|
||||
}
|
||||
|
||||
Status VideoDecoder::Decode(const InputBuffer_2& aInputBuffer,
|
||||
VideoFrame* aVideoFrame) {
|
||||
cdm::Status VideoDecoder::Decode(const cdm::InputBuffer_2& aInputBuffer,
|
||||
cdm::VideoFrame* aVideoFrame) {
|
||||
CK_LOGD("VideoDecoder::Decode");
|
||||
// If the input buffer we have been passed has a null buffer, it means we
|
||||
// should drain.
|
||||
|
@ -79,7 +79,7 @@ Status VideoDecoder::Decode(const InputBuffer_2& aInputBuffer,
|
|||
|
||||
if (!data || !mDecoder) {
|
||||
CK_LOGE("Decode job not set up correctly!");
|
||||
return Status::kDecodeError;
|
||||
return cdm::Status::kDecodeError;
|
||||
}
|
||||
|
||||
std::vector<uint8_t>& buffer = data->mBuffer;
|
||||
|
@ -105,13 +105,13 @@ Status VideoDecoder::Decode(const InputBuffer_2& aInputBuffer,
|
|||
CK_LOGE("VideoDecoder::Decode() decode failed ret=0x%x%s", hr,
|
||||
((hr == MF_E_NOTACCEPTING) ? " (MF_E_NOTACCEPTING)" : ""));
|
||||
CK_LOGD("Decode failed. The decoder is not accepting input");
|
||||
return Status::kDecodeError;
|
||||
return cdm::Status::kDecodeError;
|
||||
}
|
||||
|
||||
return OutputFrame(aVideoFrame);
|
||||
}
|
||||
|
||||
Status VideoDecoder::OutputFrame(VideoFrame* aVideoFrame) {
|
||||
cdm::Status VideoDecoder::OutputFrame(cdm::VideoFrame* aVideoFrame) {
|
||||
CK_LOGD("VideoDecoder::OutputFrame");
|
||||
|
||||
HRESULT hr = S_OK;
|
||||
|
@ -137,14 +137,14 @@ Status VideoDecoder::OutputFrame(VideoFrame* aVideoFrame) {
|
|||
// If we don't have any inputs, we need more data.
|
||||
if (mOutputQueue.empty()) {
|
||||
CK_LOGD("Decode failed. Not enought data; Requesting more input");
|
||||
return Status::kNeedMoreData;
|
||||
return cdm::Status::kNeedMoreData;
|
||||
}
|
||||
|
||||
// We will get a MF_E_TRANSFORM_NEED_MORE_INPUT every time, as we always
|
||||
// consume everything in the buffer.
|
||||
if (hr != MF_E_TRANSFORM_NEED_MORE_INPUT && FAILED(hr)) {
|
||||
CK_LOGD("Decode failed output ret=0x%x", hr);
|
||||
return Status::kDecodeError;
|
||||
return cdm::Status::kDecodeError;
|
||||
}
|
||||
|
||||
CComPtr<IMFSample> result = mOutputQueue.front();
|
||||
|
@ -154,7 +154,7 @@ Status VideoDecoder::OutputFrame(VideoFrame* aVideoFrame) {
|
|||
// they are theoretically possible in real world data.
|
||||
if (mDecoder->GetStride() <= 0) {
|
||||
CK_LOGD("VideoDecoder::OutputFrame Failed! (negative stride)");
|
||||
return Status::kDecodeError;
|
||||
return cdm::Status::kDecodeError;
|
||||
}
|
||||
|
||||
const IntRect& picture = mDecoder->GetPictureRegion();
|
||||
|
@ -163,18 +163,18 @@ Status VideoDecoder::OutputFrame(VideoFrame* aVideoFrame) {
|
|||
aVideoFrame);
|
||||
if (FAILED(hr)) {
|
||||
CK_LOGD("VideoDecoder::OutputFrame Failed!");
|
||||
return Status::kDecodeError;
|
||||
return cdm::Status::kDecodeError;
|
||||
}
|
||||
|
||||
CK_LOGD("VideoDecoder::OutputFrame Succeeded.");
|
||||
return Status::kSuccess;
|
||||
return cdm::Status::kSuccess;
|
||||
}
|
||||
|
||||
HRESULT
|
||||
VideoDecoder::SampleToVideoFrame(IMFSample* aSample, int32_t aPictureWidth,
|
||||
int32_t aPictureHeight, int32_t aStride,
|
||||
int32_t aFrameHeight,
|
||||
VideoFrame* aVideoFrame) {
|
||||
cdm::VideoFrame* aVideoFrame) {
|
||||
CK_LOGD("[%p] VideoDecoder::SampleToVideoFrame()", this);
|
||||
|
||||
ENSURE(aSample != nullptr, E_POINTER);
|
||||
|
@ -218,11 +218,11 @@ VideoDecoder::SampleToVideoFrame(IMFSample* aSample, int32_t aPictureWidth,
|
|||
uint32_t srcUVSize = stride * (aFrameHeight + padding) / 4;
|
||||
uint32_t halfStride = (stride + 1) / 2;
|
||||
|
||||
aVideoFrame->SetStride(VideoFrame::kYPlane, stride);
|
||||
aVideoFrame->SetStride(VideoFrame::kUPlane, halfStride);
|
||||
aVideoFrame->SetStride(VideoFrame::kVPlane, halfStride);
|
||||
aVideoFrame->SetStride(cdm::VideoPlane::kYPlane, stride);
|
||||
aVideoFrame->SetStride(cdm::VideoPlane::kUPlane, halfStride);
|
||||
aVideoFrame->SetStride(cdm::VideoPlane::kVPlane, halfStride);
|
||||
|
||||
aVideoFrame->SetSize(Size{aPictureWidth, aPictureHeight});
|
||||
aVideoFrame->SetSize(cdm::Size{aPictureWidth, aPictureHeight});
|
||||
|
||||
// Note: We allocate the minimal sized buffer required to send the
|
||||
// frame back over to the parent process. This is so that we request the
|
||||
|
@ -239,7 +239,7 @@ VideoDecoder::SampleToVideoFrame(IMFSample* aSample, int32_t aPictureWidth,
|
|||
}
|
||||
|
||||
// Get the buffer from the host.
|
||||
Buffer* buffer = mHost->Allocate(bufferSize.value());
|
||||
cdm::Buffer* buffer = mHost->Allocate(bufferSize.value());
|
||||
aVideoFrame->SetFrameBuffer(buffer);
|
||||
|
||||
// Make sure the buffer is non-null (allocate guarantees it will be of
|
||||
|
@ -251,17 +251,17 @@ VideoDecoder::SampleToVideoFrame(IMFSample* aSample, int32_t aPictureWidth,
|
|||
|
||||
uint8_t* outBuffer = buffer->Data();
|
||||
|
||||
aVideoFrame->SetPlaneOffset(VideoFrame::kYPlane, 0);
|
||||
aVideoFrame->SetPlaneOffset(cdm::VideoPlane::kYPlane, 0);
|
||||
|
||||
// Offset of U plane is the size of the Y plane, excluding the padding that
|
||||
// WMF adds.
|
||||
uint32_t dstUOffset = stride * aPictureHeight;
|
||||
aVideoFrame->SetPlaneOffset(VideoFrame::kUPlane, dstUOffset);
|
||||
aVideoFrame->SetPlaneOffset(cdm::VideoPlane::kUPlane, dstUOffset);
|
||||
|
||||
// Offset of the V plane is the size of the Y plane + the size of the U plane,
|
||||
// excluding any padding WMF adds.
|
||||
uint32_t dstVOffset = stride * aPictureHeight + (stride * aPictureHeight) / 4;
|
||||
aVideoFrame->SetPlaneOffset(VideoFrame::kVPlane, dstVOffset);
|
||||
aVideoFrame->SetPlaneOffset(cdm::VideoPlane::kVPlane, dstVOffset);
|
||||
|
||||
// Copy the pixel data, excluding WMF's padding.
|
||||
memcpy(outBuffer, data, stride * aPictureHeight);
|
||||
|
@ -298,7 +298,7 @@ void VideoDecoder::Reset() {
|
|||
}
|
||||
}
|
||||
|
||||
Status VideoDecoder::Drain(VideoFrame* aVideoFrame) {
|
||||
cdm::Status VideoDecoder::Drain(cdm::VideoFrame* aVideoFrame) {
|
||||
CK_LOGD("VideoDecoder::Drain()");
|
||||
|
||||
if (!mDecoder) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче