mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1037317 - Move GMPBufferType to be a property of GMPVideoFrameEncoded. r=jesup
This commit is contained in:
parent
e2804681c2
commit
51e6635487
@ -3,6 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using GMPBufferType from "gmp-video-codec.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace gmp {
|
||||
|
||||
@ -14,6 +16,7 @@ struct GMPVideoEncodedFrameData
|
||||
uint64_t mDuration; // microseconds
|
||||
uint32_t mFrameType;
|
||||
uint32_t mSize;
|
||||
GMPBufferType mBufferType;
|
||||
Shmem mBuffer;
|
||||
bool mCompleteFrame;
|
||||
};
|
||||
|
@ -123,7 +123,6 @@ GMPVideoDecoderChild::RecvInitDecode(const GMPVideoCodec& aCodecSettings,
|
||||
bool
|
||||
GMPVideoDecoderChild::RecvDecode(const GMPVideoEncodedFrameData& aInputFrame,
|
||||
const bool& aMissingFrames,
|
||||
const GMPBufferType& aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const int64_t& aRenderTimeMs)
|
||||
{
|
||||
@ -136,7 +135,6 @@ GMPVideoDecoderChild::RecvDecode(const GMPVideoEncodedFrameData& aInputFrame,
|
||||
// Ignore any return code. It is OK for this to fail without killing the process.
|
||||
mVideoDecoder->Decode(f,
|
||||
aMissingFrames,
|
||||
aBufferType,
|
||||
aCodecSpecificInfo.Elements(),
|
||||
aCodecSpecificInfo.Length(),
|
||||
aRenderTimeMs);
|
||||
|
@ -67,7 +67,6 @@ private:
|
||||
const int32_t& aCoreCount) MOZ_OVERRIDE;
|
||||
virtual bool RecvDecode(const GMPVideoEncodedFrameData& aInputFrame,
|
||||
const bool& aMissingFrames,
|
||||
const GMPBufferType& aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const int64_t& aRenderTimeMs) MOZ_OVERRIDE;
|
||||
virtual bool RecvChildShmemForPool(Shmem& aFrameBuffer) MOZ_OVERRIDE;
|
||||
|
@ -72,7 +72,6 @@ GMPVideoDecoderParent::InitDecode(const GMPVideoCodec& aCodecSettings,
|
||||
nsresult
|
||||
GMPVideoDecoderParent::Decode(GMPVideoEncodedFrame* aInputFrame,
|
||||
bool aMissingFrames,
|
||||
GMPBufferType aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs)
|
||||
{
|
||||
@ -100,7 +99,6 @@ GMPVideoDecoderParent::Decode(GMPVideoEncodedFrame* aInputFrame,
|
||||
|
||||
if (!SendDecode(frameData,
|
||||
aMissingFrames,
|
||||
aBufferType,
|
||||
aCodecSpecificInfo,
|
||||
aRenderTimeMs)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -37,7 +37,6 @@ public:
|
||||
int32_t aCoreCount) MOZ_OVERRIDE;
|
||||
virtual nsresult Decode(GMPVideoEncodedFrame* aInputFrame,
|
||||
bool aMissingFrames,
|
||||
GMPBufferType aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs = -1) MOZ_OVERRIDE;
|
||||
virtual nsresult Reset() MOZ_OVERRIDE;
|
||||
|
@ -23,7 +23,6 @@ public:
|
||||
int32_t aCoreCount) = 0;
|
||||
virtual nsresult Decode(GMPVideoEncodedFrame* aInputFrame,
|
||||
bool aMissingFrames,
|
||||
GMPBufferType aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs = -1) = 0;
|
||||
virtual nsresult Reset() = 0;
|
||||
|
@ -19,7 +19,8 @@ GMPVideoEncodedFrameImpl::GMPVideoEncodedFrameImpl(GMPVideoHostImpl* aHost)
|
||||
mFrameType(kGMPDeltaFrame),
|
||||
mSize(0),
|
||||
mCompleteFrame(false),
|
||||
mHost(aHost)
|
||||
mHost(aHost),
|
||||
mBufferType(GMP_BufferSingle)
|
||||
{
|
||||
MOZ_ASSERT(aHost);
|
||||
aHost->EncodedFrameCreated(this);
|
||||
@ -35,7 +36,8 @@ GMPVideoEncodedFrameImpl::GMPVideoEncodedFrameImpl(const GMPVideoEncodedFrameDat
|
||||
mSize(aFrameData.mSize()),
|
||||
mCompleteFrame(aFrameData.mCompleteFrame()),
|
||||
mHost(aHost),
|
||||
mBuffer(aFrameData.mBuffer())
|
||||
mBuffer(aFrameData.mBuffer()),
|
||||
mBufferType(aFrameData.mBufferType())
|
||||
{
|
||||
MOZ_ASSERT(aHost);
|
||||
aHost->EncodedFrameCreated(this);
|
||||
@ -92,6 +94,7 @@ GMPVideoEncodedFrameImpl::RelinquishFrameData(GMPVideoEncodedFrameData& aFrameDa
|
||||
aFrameData.mSize() = mSize;
|
||||
aFrameData.mCompleteFrame() = mCompleteFrame;
|
||||
aFrameData.mBuffer() = mBuffer;
|
||||
aFrameData.mBufferType() = mBufferType;
|
||||
|
||||
// This method is called right before Shmem is sent to another process.
|
||||
// We need to effectively zero out our member copy so that we don't
|
||||
@ -147,6 +150,7 @@ GMPVideoEncodedFrameImpl::CopyFrame(const GMPVideoEncodedFrame& aFrame)
|
||||
mFrameType = f.mFrameType;
|
||||
mSize = f.mSize; // already set...
|
||||
mCompleteFrame = f.mCompleteFrame;
|
||||
mBufferType = f.mBufferType;
|
||||
// Don't copy host, that should have been set properly on object creation via host.
|
||||
|
||||
return GMPNoErr;
|
||||
@ -290,5 +294,17 @@ GMPVideoEncodedFrameImpl::Destroy()
|
||||
delete this;
|
||||
}
|
||||
|
||||
GMPBufferType
|
||||
GMPVideoEncodedFrameImpl::BufferType() const
|
||||
{
|
||||
return mBufferType;
|
||||
}
|
||||
|
||||
void
|
||||
GMPVideoEncodedFrameImpl::SetBufferType(GMPBufferType aBufferType)
|
||||
{
|
||||
mBufferType = aBufferType;
|
||||
}
|
||||
|
||||
} // namespace gmp
|
||||
} // namespace mozilla
|
||||
|
@ -89,6 +89,8 @@ public:
|
||||
virtual bool CompleteFrame() MOZ_OVERRIDE;
|
||||
virtual const uint8_t* Buffer() const MOZ_OVERRIDE;
|
||||
virtual uint8_t* Buffer() MOZ_OVERRIDE;
|
||||
virtual GMPBufferType BufferType() const MOZ_OVERRIDE;
|
||||
virtual void SetBufferType(GMPBufferType aBufferType) MOZ_OVERRIDE;
|
||||
virtual const GMPEncryptedBufferData* GetDecryptionData() const MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
@ -103,6 +105,7 @@ private:
|
||||
bool mCompleteFrame;
|
||||
GMPVideoHostImpl* mHost;
|
||||
ipc::Shmem mBuffer;
|
||||
GMPBufferType mBufferType;
|
||||
};
|
||||
|
||||
} // namespace gmp
|
||||
|
@ -40,7 +40,6 @@ GMPVideoEncoderChild::Host()
|
||||
|
||||
void
|
||||
GMPVideoEncoderChild::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
const uint8_t* aCodecSpecificInfo,
|
||||
uint32_t aCodecSpecificInfoLength)
|
||||
{
|
||||
@ -53,7 +52,7 @@ GMPVideoEncoderChild::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
|
||||
nsTArray<uint8_t> codecSpecific;
|
||||
codecSpecific.AppendElements(aCodecSpecificInfo, aCodecSpecificInfoLength);
|
||||
SendEncoded(frameData, aBufferType, codecSpecific);
|
||||
SendEncoded(frameData, codecSpecific);
|
||||
|
||||
aEncodedFrame->Destroy();
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
|
||||
// GMPVideoEncoderCallback
|
||||
virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
const uint8_t* aCodecSpecificInfo,
|
||||
uint32_t aCodecSpecificInfoLength) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -203,7 +203,6 @@ GMPVideoEncoderParent::CheckThread()
|
||||
|
||||
bool
|
||||
GMPVideoEncoderParent::RecvEncoded(const GMPVideoEncodedFrameData& aEncodedFrame,
|
||||
const GMPBufferType& aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo)
|
||||
{
|
||||
if (!mCallback) {
|
||||
@ -213,7 +212,7 @@ GMPVideoEncoderParent::RecvEncoded(const GMPVideoEncodedFrameData& aEncodedFrame
|
||||
auto f = new GMPVideoEncodedFrameImpl(aEncodedFrame, &mVideoHost);
|
||||
|
||||
// Ignore any return code. It is OK for this to fail without killing the process.
|
||||
mCallback->Encoded(f, aBufferType, aCodecSpecificInfo);
|
||||
mCallback->Encoded(f, aCodecSpecificInfo);
|
||||
|
||||
// Return SHM to sender to recycle
|
||||
//SendEncodedReturn(aEncodedFrame, aCodecSpecificInfo);
|
||||
|
@ -65,7 +65,6 @@ private:
|
||||
// PGMPVideoEncoderParent
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
||||
virtual bool RecvEncoded(const GMPVideoEncodedFrameData& aEncodedFrame,
|
||||
const GMPBufferType& aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo) MOZ_OVERRIDE;
|
||||
virtual bool RecvParentShmemForPool(Shmem& aFrameBuffer) MOZ_OVERRIDE;
|
||||
virtual bool AnswerNeedShmem(const uint32_t& aEncodedBufferSize,
|
||||
|
@ -14,7 +14,6 @@
|
||||
class GMPVideoEncoderCallbackProxy {
|
||||
public:
|
||||
virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo) = 0;
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,6 @@ include protocol PGMP;
|
||||
include GMPTypes;
|
||||
|
||||
using GMPVideoCodec from "gmp-video-codec.h";
|
||||
using GMPBufferType from "gmp-video-codec.h";
|
||||
|
||||
include "GMPMessageUtils.h";
|
||||
|
||||
@ -23,7 +22,6 @@ child:
|
||||
int32_t aCoreCount);
|
||||
async Decode(GMPVideoEncodedFrameData aInputFrame,
|
||||
bool aMissingFrames,
|
||||
GMPBufferType aBufferType,
|
||||
uint8_t[] aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs);
|
||||
async Reset();
|
||||
|
@ -8,7 +8,6 @@ include GMPTypes;
|
||||
|
||||
using GMPVideoCodec from "gmp-video-codec.h";
|
||||
using GMPVideoFrameType from "gmp-video-frame-encoded.h";
|
||||
using GMPBufferType from "gmp-video-codec.h";
|
||||
|
||||
include "GMPMessageUtils.h";
|
||||
|
||||
@ -35,7 +34,6 @@ child:
|
||||
parent:
|
||||
async __delete__();
|
||||
async Encoded(GMPVideoEncodedFrameData aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
uint8_t[] aCodecSpecificInfo);
|
||||
async ParentShmemForPool(Shmem aFrameBuffer);
|
||||
// MUST be intr - if sync and we create a new Shmem, when the returned
|
||||
|
@ -84,7 +84,6 @@ public:
|
||||
// - aInputFrame: Frame to decode. Call Destroy() on frame when it's decoded.
|
||||
// - aMissingFrames: True if one or more frames have been lost since the
|
||||
// previous decode call.
|
||||
// - aBufferType : type of frame to encode
|
||||
// - aCodecSpecificInfo : codec specific data, pointer to a
|
||||
// GMPCodecSpecificInfo structure appropriate for
|
||||
// this codec type.
|
||||
@ -93,7 +92,6 @@ public:
|
||||
// decoders with internal rendering.
|
||||
virtual GMPErr Decode(GMPVideoEncodedFrame* aInputFrame,
|
||||
bool aMissingFrames,
|
||||
GMPBufferType aBufferType,
|
||||
const uint8_t* aCodecSpecificInfo,
|
||||
uint32_t aCodecSpecificInfoLength,
|
||||
int64_t aRenderTimeMs = -1) = 0;
|
||||
|
@ -49,7 +49,6 @@ public:
|
||||
virtual ~GMPVideoEncoderCallback() {}
|
||||
|
||||
virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
const uint8_t* aCodecSpecificInfo,
|
||||
uint32_t aCodecSpecificInfoLength) = 0;
|
||||
};
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <stdint.h>
|
||||
#include "gmp-decryption.h"
|
||||
#include "gmp-video-frame.h"
|
||||
#include "gmp-video-codec.h"
|
||||
|
||||
enum GMPVideoFrameType
|
||||
{
|
||||
@ -86,6 +87,9 @@ public:
|
||||
virtual bool CompleteFrame() = 0;
|
||||
virtual const uint8_t* Buffer() const = 0;
|
||||
virtual uint8_t* Buffer() = 0;
|
||||
virtual GMPBufferType BufferType() const = 0;
|
||||
virtual void SetBufferType(GMPBufferType aBufferType) = 0;
|
||||
|
||||
// Get data describing how this frame is encrypted, or nullptr if the
|
||||
// frame is not encrypted.
|
||||
virtual const GMPEncryptedBufferData* GetDecryptionData() const = 0;
|
||||
|
@ -317,7 +317,6 @@ WebrtcGmpVideoEncoder::SetRates_g(uint32_t aNewBitRate, uint32_t aFrameRate)
|
||||
// GMPVideoEncoderCallback virtual functions.
|
||||
void
|
||||
WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo)
|
||||
{
|
||||
if (mCallback) { // paranoia
|
||||
@ -325,7 +324,9 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GmpFrameTypeToWebrtcFrameType(aEncodedFrame->FrameType(), &ft);
|
||||
uint32_t timestamp = (aEncodedFrame->TimeStamp() * 90ll + 999)/1000;
|
||||
|
||||
LOGD(("GMP Encoded: %llu, type %d, len %d", aEncodedFrame->TimeStamp(), aBufferType,
|
||||
LOGD(("GMP Encoded: %llu, type %d, len %d",
|
||||
aEncodedFrame->TimeStamp(),
|
||||
aEncodedFrame->BufferType(),
|
||||
aEncodedFrame->Size()));
|
||||
|
||||
// Right now makes one Encoded() callback per unit
|
||||
@ -335,7 +336,7 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
uint8_t *end = aEncodedFrame->Buffer() + aEncodedFrame->Size();
|
||||
uint32_t size;
|
||||
while (buffer < end) {
|
||||
switch (aBufferType) {
|
||||
switch (aEncodedFrame->BufferType()) {
|
||||
case GMP_BufferSingle:
|
||||
size = aEncodedFrame->Size();
|
||||
break;
|
||||
@ -362,7 +363,7 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
break;
|
||||
default:
|
||||
// really that it's not in the enum; gives more readable error
|
||||
MOZ_ASSERT(aBufferType != GMP_BufferSingle);
|
||||
MOZ_ASSERT(aEncodedFrame->BufferType() != GMP_BufferSingle);
|
||||
aEncodedFrame->Destroy();
|
||||
return;
|
||||
}
|
||||
@ -379,7 +380,6 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
aEncodedFrame->Destroy();
|
||||
}
|
||||
|
||||
|
||||
// Decoder.
|
||||
WebrtcGmpVideoDecoder::WebrtcGmpVideoDecoder() :
|
||||
mGMPThread(nullptr),
|
||||
@ -504,6 +504,7 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage,
|
||||
frame->SetEncodedHeight(aInputImage._encodedHeight);
|
||||
frame->SetTimeStamp((aInputImage._timeStamp * 1000ll)/90); // rounds down
|
||||
frame->SetCompleteFrame(aInputImage._completeFrame);
|
||||
frame->SetBufferType(GMP_BufferLength32);
|
||||
|
||||
GMPVideoFrameType ft;
|
||||
int32_t ret = WebrtcFrameTypeToGmpFrameType(aInputImage._frameType, &ft);
|
||||
@ -522,7 +523,6 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage,
|
||||
LOGD(("GMP Decode: %llu, len %d", frame->TimeStamp(), aInputImage._length));
|
||||
nsresult rv = mGMP->Decode(frame,
|
||||
aMissingFrames,
|
||||
GMP_BufferLength32,
|
||||
codecSpecificInfo,
|
||||
aRenderTimeMs);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -66,7 +66,6 @@ public:
|
||||
|
||||
// GMPVideoEncoderCallback virtual functions.
|
||||
virtual void Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
||||
GMPBufferType aBufferType,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo) MOZ_OVERRIDE;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user