/* * Copyright (c) 2012, The WebRTC project authors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * * Neither the name of Google nor the names of its contributors may * be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
glean::webrtc::gmp_init_success
.EnumGet(static_cast<glean::webrtc::GmpInitSuccessLabel>(
aResult == WEBRTC_VIDEO_CODEC_OK))
.Add(); if (aResult == WEBRTC_VIDEO_CODEC_OK) { // Might be useful to notify the PeerConnection about successful init // someday. return;
}
PeerConnectionWrapper wrapper(aPCHandle); if (wrapper.impl()) {
wrapper.impl()->OnMediaError(aError);
}
}
// Hold a frame for later decode class GMPDecodeData { public:
GMPDecodeData(const webrtc::EncodedImage& aInputImage, bool aMissingFrames,
int64_t aRenderTimeMs)
: mImage(aInputImage),
mMissingFrames(aMissingFrames),
mRenderTimeMs(aRenderTimeMs) { // We want to use this for queuing, and the calling code recycles the // buffer on return from Decode()
MOZ_RELEASE_ASSERT(aInputImage.size() <
(std::numeric_limits<size_t>::max() >> 1));
}
class RefCountedWebrtcVideoEncoder { public:
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
// Implement sort of WebrtcVideoEncoder interface and support refcounting. // (We cannot use |Release|, since that's needed for nsRefPtr) virtual int32_t InitEncode( const webrtc::VideoCodec* aCodecSettings, const webrtc::VideoEncoder::Settings& aSettings) = 0;
class WebrtcGmpVideoEncoder final : public GMPVideoEncoderCallbackProxy, public RefCountedWebrtcVideoEncoder { public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebrtcGmpVideoEncoder, final);
// Basically a strong ref to a RefCountedWebrtcVideoEncoder, that also // translates from Release() to RefCountedWebrtcVideoEncoder::Shutdown(), // since we need RefCountedWebrtcVideoEncoder::Release() for managing the // refcount. The webrtc.org code gets one of these, so it doesn't unilaterally // delete the "real" encoder. class WebrtcVideoEncoderProxy final : public WebrtcVideoEncoder { public: explicit WebrtcVideoEncoderProxy(
RefPtr<RefCountedWebrtcVideoEncoder> aEncoder)
: mEncoderImpl(std::move(aEncoder)) {}
class WebrtcGmpVideoDecoder final : public GMPVideoDecoderCallbackProxy { public:
WebrtcGmpVideoDecoder(std::string aPCHandle, TrackingId aTrackingId);
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebrtcGmpVideoDecoder, final);
class InitDoneCallback final : public GetGMPVideoDecoderCallback { public: explicit InitDoneCallback(const RefPtr<WebrtcGmpVideoDecoder>& aDecoder)
: mDecoder(aDecoder) {}
nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
nsCOMPtr<nsIThread> mGMPThread;
GMPVideoDecoderProxy* mGMP; // Addref is held for us // Used to handle a race where Release() is called while init is in progress bool mInitting; // Frames queued for decode while mInitting is true
nsTArray<UniquePtr<GMPDecodeData>> mQueuedFrames;
GMPVideoHost* mHost; // Protects mCallback
Mutex mCallbackMutex;
webrtc::DecodedImageCallback* mCallback MOZ_GUARDED_BY(mCallbackMutex);
Maybe<uint64_t> mCachedPluginId;
Atomic<GMPErr, ReleaseAcquire> mDecoderStatus; const std::string mPCHandle; const TrackingId mTrackingId;
PerformanceRecorderMulti<DecodeStage> mPerformanceRecorder;
// Basically a strong ref to a WebrtcGmpVideoDecoder, that also translates // from Release() to WebrtcGmpVideoDecoder::ReleaseGmp(), since we need // WebrtcGmpVideoDecoder::Release() for managing the refcount. // The webrtc.org code gets one of these, so it doesn't unilaterally delete // the "real" encoder. class WebrtcVideoDecoderProxy final : public WebrtcVideoDecoder { public: explicit WebrtcVideoDecoderProxy(std::string aPCHandle,
TrackingId aTrackingId)
: mDecoderImpl(new WebrtcGmpVideoDecoder(std::move(aPCHandle),
std::move(aTrackingId))) {}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.