Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/dom/media/gmp/   (Firefox Browser Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  GMPVideoHost.cpp

  Sprache: C
 

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * 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/. */


#include "GMPVideoHost.h"
#include "mozilla/Assertions.h"
#include "GMPSharedMemManager.h"
#include "GMPVideoPlaneImpl.h"
#include "GMPVideoi420FrameImpl.h"
#include "GMPVideoEncodedFrameImpl.h"

namespace mozilla::gmp {

GMPVideoHostImpl::GMPVideoHostImpl(GMPSharedMemManager* aSharedMemMgr)
    : mSharedMemMgr(aSharedMemMgr) {}

GMPVideoHostImpl::~GMPVideoHostImpl() = default;

GMPErr GMPVideoHostImpl::CreateFrame(GMPVideoFrameFormat aFormat,
                                     GMPVideoFrame** aFrame) {
  if (!mSharedMemMgr) {
    return GMPGenericErr;
  }

  if (!aFrame) {
    return GMPGenericErr;
  }
  *aFrame = nullptr;

  switch (aFormat) {
    case kGMPI420VideoFrame:
      *aFrame = new GMPVideoi420FrameImpl(this);
      return GMPNoErr;
    case kGMPEncodedVideoFrame:
      *aFrame = new GMPVideoEncodedFrameImpl(this);
      return GMPNoErr;
    default:
      MOZ_ASSERT_UNREACHABLE("Unknown frame format!");
  }

  return GMPGenericErr;
}

GMPErr GMPVideoHostImpl::CreatePlane(GMPPlane** aPlane) {
  if (!mSharedMemMgr) {
    return GMPGenericErr;
  }

  if (!aPlane) {
    return GMPGenericErr;
  }
  *aPlane = nullptr;

  auto* p = new GMPPlaneImpl();

  *aPlane = p;

  return GMPNoErr;
}

GMPSharedMemManager* GMPVideoHostImpl::SharedMemMgr() { return mSharedMemMgr; }

// XXX This should merge with ActorDestroyed
void GMPVideoHostImpl::DoneWithAPI() { ActorDestroyed(); }

void GMPVideoHostImpl::ActorDestroyed() {
  for (uint32_t i = mEncodedFrames.Length(); i > 0; i--) {
    mEncodedFrames[i - 1]->DoneWithAPI();
    mEncodedFrames.RemoveElementAt(i - 1);
  }
  for (uint32_t i = mDecodedFrames.Length(); i > 0; i--) {
    mDecodedFrames[i - 1]->DoneWithAPI();
    mDecodedFrames.RemoveElementAt(i - 1);
  }
  mSharedMemMgr->MgrPurgeShmems();
  mSharedMemMgr = nullptr;
}

void GMPVideoHostImpl::EncodedFrameCreated(
    GMPVideoEncodedFrameImpl* aEncodedFrame) {
  mEncodedFrames.AppendElement(aEncodedFrame);
}

void GMPVideoHostImpl::EncodedFrameDestroyed(GMPVideoEncodedFrameImpl* aFrame) {
  MOZ_ALWAYS_TRUE(mEncodedFrames.RemoveElement(aFrame));
}

void GMPVideoHostImpl::DecodedFrameCreated(
    GMPVideoi420FrameImpl* aDecodedFrame) {
  mDecodedFrames.AppendElement(aDecodedFrame);
}

void GMPVideoHostImpl::DecodedFrameDestroyed(GMPVideoi420FrameImpl* aFrame) {
  MOZ_ALWAYS_TRUE(mDecodedFrames.RemoveElement(aFrame));
}

}  // namespace mozilla::gmp

Messung V0.5 in Prozent
C=96 H=88 G=91

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-04) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

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.