Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/Documentation/admin-guide/device-mapper/   (Linux Kernel Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 2 kB image not shown  

Quelle  MediaProfilerMarkers.h   Sprache: unbekannt

 
/* 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/. */


#ifndef DOM_MEDIA_UTILS_MEDIAPROFILERMARKERS_H_
#define DOM_MEDIA_UTILS_MEDIAPROFILERMARKERS_H_

#include "mozilla/BaseProfilerMarkersPrerequisites.h"
#include "mozilla/Flow.h"
#include "mozilla/ProfilerMarkers.h"

namespace mozilla {

// Following markers are used for HTMLMediaElement

struct TimeUpdateMarker : public BaseMarkerType<TimeUpdateMarker> {
  static constexpr const char* Name = "HTMLMediaElement:Timeupdate";
  static constexpr const char* Description =
      "A marker shows the current playback position";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"currentTimeMs", MS::InputType::Uint64, "Current Time (Ms)",
       MS::Format::Milliseconds},
      {"mediaDurationMs", MS::InputType::Uint64, "Media Duration (Ms)",
       MS::Format::Milliseconds},
      {"paintedFrames", MS::InputType::Uint32, "Painted Frames",
       MS::Format::Integer},  // optional, zero for audio
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };
  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
  static void StreamJSONMarkerData(baseprofiler::SpliceableJSONWriter& aWriter,
                                   uint64_t aCurrentTime, uint64_t aDuration,
                                   uint32_t aPaintedFrames, Flow aFlow) {
    aWriter.IntProperty("currentTimeMs", aCurrentTime);
    aWriter.IntProperty("mediaDurationMs", aDuration);
    if (aPaintedFrames != 0) {
      aWriter.IntProperty("paintedFrames", aPaintedFrames);
    }
    aWriter.FlowProperty("element", aFlow);
  }
};

struct BufferedUpdateMarker : public BaseMarkerType<BufferedUpdateMarker> {
  static constexpr const char* Name = "HTMLMediaElement:BufferedUpdate";
  static constexpr const char* Description =
      "A marker shows the current buffered ranges";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"bufferStartMs", MS::InputType::Uint64, "Buffer Start (Ms)",
       MS::Format::Milliseconds},
      {"bufferEndMs", MS::InputType::Uint64, "Buffer End (Ms)",
       MS::Format::Milliseconds},
      {"mediaDurationMs", MS::InputType::Uint64, "Media Duration (Ms)",
       MS::Format::Milliseconds},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };

  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

struct VideoResizeMarker : public BaseMarkerType<VideoResizeMarker> {
  static constexpr const char* Name = "HTMLMediaElement:VideoResize";
  static constexpr const char* Description =
      "A marker shows the current displayed size of the video element";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"width", MS::InputType::Uint64, "Width", MS::Format::Integer},
      {"height", MS::InputType::Uint64, "Height", MS::Format::Integer},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };

  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

struct MetadataMarker : public BaseMarkerType<MetadataMarker> {
  static constexpr const char* Name = "HTMLMediaElement:MetadataLoaded";
  static constexpr const char* Description =
      "A marker shows the current metadata of the video element";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"src", MS::InputType::String, "Source URL", MS::Format::String},
      {"audioMimeType", MS::InputType::CString, "Audio Mimetype",
       MS::Format::String},
      {"videoMimeType", MS::InputType::CString, "Video Mimetype",
       MS::Format::String},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };

  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

struct CDMResolvedMarker : public BaseMarkerType<CDMResolvedMarker> {
  static constexpr const char* Name = "HTMLMediaElement:CDMResolved";
  static constexpr const char* Description =
      "A marker shows the supported config for a resolved CDM";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"keySystem", MS::InputType::String, "Key System", MS::Format::String},
      {"configuration", MS::InputType::CString, "Configuration",
       MS::Format::String},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };

  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

struct LoadErrorMarker : public BaseMarkerType<LoadErrorMarker> {
  static constexpr const char* Name = "HTMLMediaElement:Error";
  static constexpr const char* Description =
      "A marker shows the detail of the load error";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"errorMessage", MS::InputType::CString, "Error Message",
       MS::Format::String},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };
  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

struct ErrorMarker : public BaseMarkerType<ErrorMarker> {
  static constexpr const char* Name = "HTMLMediaElement:Error";
  static constexpr const char* Description =
      "A marker shows the detail of the error";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"errorMessage", MS::InputType::String, "Error Message",
       MS::Format::String},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };
  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

struct LoadSourceMarker : public BaseMarkerType<LoadSourceMarker> {
  static constexpr const char* Name = "HTMLMediaElement:LoadSource";
  static constexpr const char* Description =
      "A marker shows the detail of the source a media element trying to load";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"src", MS::InputType::String, "Source URL", MS::Format::String},
      // Below attributes would only be set if the source if a source element
      {"contentType", MS::InputType::String, "Content Type",
       MS::Format::String},
      {"media", MS::InputType::String, "Media", MS::Format::String},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };

  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
};

// This marker is for HTMLVideoElement
struct RenderVideoMarker : public BaseMarkerType<RenderVideoMarker> {
  static constexpr const char* Name = "HTMLMediaElement:RenderVideo";
  static constexpr const char* Description =
      "A marker shows how many video frames has been painted";

  using MS = MarkerSchema;
  static constexpr MS::PayloadField PayloadFields[] = {
      {"paintedFrames", MS::InputType::Uint64, "Painted Frames",
       MS::Format::Integer},
      {
          "element",
          MS::InputType::Flow,
          "Element",
          MS::Format::Flow,
      },
  };
  static constexpr MS::Location Locations[] = {MS::Location::MarkerChart,
                                               MS::Location::MarkerTable};
  static constexpr const char* ChartLabel = "{marker.data.name}";
  static void StreamJSONMarkerData(baseprofiler::SpliceableJSONWriter& aWriter,
                                   uint64_t aPaintedFrames, Flow aFlow) {
    aWriter.IntProperty("paintedFrames", aPaintedFrames);
    aWriter.FlowProperty("element", aFlow);
  }
};

}  // namespace mozilla

#endif  // DOM_MEDIA_UTILS_MEDIAPROFILERMARKERS_H_

Messung V0.5 in Prozent
C=95 H=97 G=95

[Dauer der Verarbeitung: 0.18 Sekunden, vorverarbeitet 2026-08-25]