зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155178 - Part 1: Convert GMPUnique into a template alias; r=cpearce
This commit is contained in:
Родитель
c8536200a3
Коммит
623b3ca075
|
@ -36,10 +36,10 @@ EMEVideoDecoder::GetNodeId()
|
|||
return mProxy->GetNodeId();
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr
|
||||
GMPUnique<GMPVideoEncodedFrame>
|
||||
EMEVideoDecoder::CreateFrame(MediaRawData* aSample)
|
||||
{
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame = GMPVideoDecoder::CreateFrame(aSample);
|
||||
GMPUnique<GMPVideoEncodedFrame> frame = GMPVideoDecoder::CreateFrame(aSample);
|
||||
if (frame && aSample->mCrypto.mValid) {
|
||||
static_cast<gmp::GMPVideoEncodedFrameImpl*>(frame.get())->InitCrypto(aSample->mCrypto);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
private:
|
||||
virtual void InitTags(nsTArray<nsCString>& aTags) override;
|
||||
virtual nsCString GetNodeId() override;
|
||||
virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample) override;
|
||||
virtual GMPUnique<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample) override;
|
||||
|
||||
nsRefPtr<CDMProxy> mProxy;
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ extern bool IsOnGMPThread();
|
|||
void
|
||||
VideoCallbackAdapter::Decoded(GMPVideoi420Frame* aDecodedFrame)
|
||||
{
|
||||
GMPUnique<GMPVideoi420Frame>::Ptr decodedFrame(aDecodedFrame);
|
||||
GMPUnique<GMPVideoi420Frame> decodedFrame(aDecodedFrame);
|
||||
|
||||
MOZ_ASSERT(IsOnGMPThread());
|
||||
|
||||
|
@ -115,7 +115,7 @@ GMPVideoDecoder::GetNodeId()
|
|||
return NS_LITERAL_CSTRING("");
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr
|
||||
GMPUnique<GMPVideoEncodedFrame>
|
||||
GMPVideoDecoder::CreateFrame(MediaRawData* aSample)
|
||||
{
|
||||
GMPVideoFrame* ftmp = nullptr;
|
||||
|
@ -125,7 +125,7 @@ GMPVideoDecoder::CreateFrame(MediaRawData* aSample)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
GMPUnique<GMPVideoEncodedFrame> frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
err = frame->CreateEmptyFrame(aSample->mSize);
|
||||
if (GMP_FAILED(err)) {
|
||||
mCallback->Error();
|
||||
|
@ -248,7 +248,7 @@ GMPVideoDecoder::Input(MediaRawData* aSample)
|
|||
|
||||
mAdapter->SetLastStreamOffset(sample->mOffset);
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame = CreateFrame(sample);
|
||||
GMPUnique<GMPVideoEncodedFrame> frame = CreateFrame(sample);
|
||||
nsTArray<uint8_t> info; // No codec specific per-frame info to pass.
|
||||
nsresult rv = mGMP->Decode(Move(frame), false, info, 0);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
protected:
|
||||
virtual void InitTags(nsTArray<nsCString>& aTags);
|
||||
virtual nsCString GetNodeId();
|
||||
virtual GMPUnique<GMPVideoEncodedFrame>::Ptr CreateFrame(MediaRawData* aSample);
|
||||
virtual GMPUnique<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
|
||||
|
||||
private:
|
||||
class GMPInitDoneRunnable : public nsRunnable
|
||||
|
|
|
@ -18,11 +18,8 @@ struct DestroyPolicy
|
|||
}
|
||||
};
|
||||
|
||||
// Ideally, this would be a template alias, but GCC 4.6 doesn't support them. See bug 1124021.
|
||||
template<typename T>
|
||||
struct GMPUnique {
|
||||
typedef mozilla::UniquePtr<T, DestroyPolicy<T>> Ptr;
|
||||
};
|
||||
using GMPUnique = mozilla::UniquePtr<T, DestroyPolicy<T>>;
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ GMPVideoDecoderParent::InitDecode(const GMPVideoCodec& aCodecSettings,
|
|||
}
|
||||
|
||||
nsresult
|
||||
GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame> aInputFrame,
|
||||
bool aMissingFrames,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs)
|
||||
|
@ -121,7 +121,7 @@ GMPVideoDecoderParent::Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
|||
|
||||
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrameImpl>::Ptr inputFrameImpl(
|
||||
GMPUnique<GMPVideoEncodedFrameImpl> inputFrameImpl(
|
||||
static_cast<GMPVideoEncodedFrameImpl*>(aInputFrame.release()));
|
||||
|
||||
// Very rough kill-switch if the plugin stops processing. If it's merely
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
const nsTArray<uint8_t>& aCodecSpecific,
|
||||
GMPVideoDecoderCallbackProxy* aCallback,
|
||||
int32_t aCoreCount) override;
|
||||
virtual nsresult Decode(GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
virtual nsresult Decode(GMPUnique<GMPVideoEncodedFrame> aInputFrame,
|
||||
bool aMissingFrames,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs = -1) override;
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
const nsTArray<uint8_t>& aCodecSpecific,
|
||||
GMPVideoDecoderCallbackProxy* aCallback,
|
||||
int32_t aCoreCount) = 0;
|
||||
virtual nsresult Decode(mozilla::GMPUnique<GMPVideoEncodedFrame>::Ptr aInputFrame,
|
||||
virtual nsresult Decode(mozilla::GMPUnique<GMPVideoEncodedFrame> aInputFrame,
|
||||
bool aMissingFrames,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
int64_t aRenderTimeMs = -1) = 0;
|
||||
|
|
|
@ -126,7 +126,7 @@ GMPVideoEncoderParent::InitEncode(const GMPVideoCodec& aCodecSettings,
|
|||
}
|
||||
|
||||
GMPErr
|
||||
GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame> aInputFrame,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const nsTArray<GMPVideoFrameType>& aFrameTypes)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ GMPVideoEncoderParent::Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
|||
|
||||
MOZ_ASSERT(mPlugin->GMPThread() == NS_GetCurrentThread());
|
||||
|
||||
GMPUnique<GMPVideoi420FrameImpl>::Ptr inputFrameImpl(
|
||||
GMPUnique<GMPVideoi420FrameImpl> inputFrameImpl(
|
||||
static_cast<GMPVideoi420FrameImpl*>(aInputFrame.release()));
|
||||
|
||||
// Very rough kill-switch if the plugin stops processing. If it's merely
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
GMPVideoEncoderCallbackProxy* aCallback,
|
||||
int32_t aNumberOfCores,
|
||||
uint32_t aMaxPayloadSize) override;
|
||||
virtual GMPErr Encode(GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
virtual GMPErr Encode(GMPUnique<GMPVideoi420Frame> aInputFrame,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const nsTArray<GMPVideoFrameType>& aFrameTypes) override;
|
||||
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) override;
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
GMPVideoEncoderCallbackProxy* aCallback,
|
||||
int32_t aNumberOfCores,
|
||||
uint32_t aMaxPayloadSize) = 0;
|
||||
virtual GMPErr Encode(mozilla::GMPUnique<GMPVideoi420Frame>::Ptr aInputFrame,
|
||||
virtual GMPErr Encode(mozilla::GMPUnique<GMPVideoi420Frame> aInputFrame,
|
||||
const nsTArray<uint8_t>& aCodecSpecificInfo,
|
||||
const nsTArray<GMPVideoFrameType>& aFrameTypes) = 0;
|
||||
virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) = 0;
|
||||
|
|
|
@ -351,7 +351,7 @@ GMPRemoveTest::gmp_Decode()
|
|||
GMPErr err = mHost->CreateFrame(kGMPEncodedVideoFrame, &absFrame);
|
||||
EXPECT_EQ(err, GMPNoErr);
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr
|
||||
GMPUnique<GMPVideoEncodedFrame>
|
||||
frame(static_cast<GMPVideoEncodedFrame*>(absFrame));
|
||||
err = frame->CreateEmptyFrame(sizeof(EncodedFrame) /* size */);
|
||||
EXPECT_EQ(err, GMPNoErr);
|
||||
|
|
|
@ -330,7 +330,7 @@ WebrtcGmpVideoEncoder::Encode_g(const webrtc::I420VideoFrame* aInputImage,
|
|||
if (err != GMPNoErr) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
GMPUnique<GMPVideoi420Frame>::Ptr frame(static_cast<GMPVideoi420Frame*>(ftmp));
|
||||
GMPUnique<GMPVideoi420Frame> frame(static_cast<GMPVideoi420Frame*>(ftmp));
|
||||
|
||||
err = frame->CreateFrame(aInputImage->allocated_size(webrtc::kYPlane),
|
||||
aInputImage->buffer(webrtc::kYPlane),
|
||||
|
@ -721,7 +721,7 @@ WebrtcGmpVideoDecoder::Decode_g(const webrtc::EncodedImage& aInputImage,
|
|||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
}
|
||||
|
||||
GMPUnique<GMPVideoEncodedFrame>::Ptr frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
GMPUnique<GMPVideoEncodedFrame> frame(static_cast<GMPVideoEncodedFrame*>(ftmp));
|
||||
err = frame->CreateEmptyFrame(aInputImage._length);
|
||||
if (err != GMPNoErr) {
|
||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||
|
|
Загрузка…
Ссылка в новой задаче