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

# Adding a new metric? We have docs for that!
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html

---
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
$tags:
  - 'Core :: Audio/Video'

gmp:
  update_xml_fetch_result:
    type: labeled_counter
    labels:
      - content_sig_success
      - content_sig_net_request_error
      - content_sig_net_timeout
      - content_sig_abort
      - content_sig_missing_data
      - content_sig_failed
      - content_sig_invalid
      - content_sig_xml_parse_error
      - content_sig_unknown_error
    description: >
      The result of Gecko fetching an update.xml from Balrog.
      This captures 2 different data points: success or failure of the request,
      and the reason for failure, if the request failed.
    metadata:
      tags:
        - 'Core :: Audio/Video: GMP'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1739664
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1739664
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    expires: never

media.audio:
  init_failure:
    type: labeled_counter
    labels:
      - first
      - other
    description: >
      Failure occurs when initializing the audio stream.
      (Migrated from the geckoview metric of the same name).
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1671714
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1879192
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1671714#c10
    notification_emails:
      - media-alerts@mozilla.com
    expires: never

  backend:
    type: labeled_counter
    labels:
      - unknown
      - audiounit
      - audiounit-rust
      - aaudio
      - opensl
      - wasapi
      - winmm
      - alsa
      - jack
      - oss
      - pulse
      - pulse-rust
      - sndio
      - sunaudio
    description: >
      The operating system audio backend
      (Migrated from the geckoview metric of the same name).
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1671714
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1879192
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1671714#c10
    notification_emails:
      - media-alerts@mozilla.com
    expires: never

media.playback:
  first_frame_loaded:
    type: event
    description:
      The time that the media pipeline takes to load the first video frame.
      Only recorded on pre-release builds (Nightly and Beta).
    metadata:
      tags:
        - 'Core :: Audio/Video: Playback'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882205
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1882205
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    extra_keys:
      first_frame_loaded_time:
        description:
          How long (in milliseconds) does the our media pipeline take to load
          the first video frame from "the creation of MDSM" to "the first frame
          loaded".
        type: quantity
      metadata_loaded_time:
        description:
          How long (in milliseconds) does the our media pipeline take to load
          the metadata, which happens before finishing loading the first frame.
        type: quantity
      total_waiting_data_time:
        description:
          How long (in milliseconds) does the our media pipeline has been in a
          state of waiting video data due to lacking of data before the first
          frame is loaded.
        type: quantity
      buffering_time:
        description:
          How long (in milliseconds) does the our media pipeline has been spent
          on the buffering state before the first frame is loaded.
        type: quantity
      playback_type:
        description:
          The type of the playback. The value could be one of following
          (1) Non-MSE playback
          (2) MSE playback
          (3) EME playback
          // Following are Windows-only
          (4) Non-MSE media-engine playback
          (5) MSE media-engine playback
          (6) EME media-engine playback
        type: string
      video_codec:
        description: The video codec used for playback
        type: string
      resolution:
        description: The video resolution used for playback
        type: string
      key_system:
        description: The key system used for the EME playback if exists
        type: string
      hls_decoder:
        description:
          This value will only be set on Android. It tells that whether playback
          is performed by the HLS decoder, which utilizes the external player to
          play video.
        type: boolean
      is_hardware_decoding:
        description: True if the first frame is decoded by a hardware decoder.
        type: boolean
      decoder_name:
        description: The name of video decoder used for playback.
        type: string
      is_hdr:
        description: True if the playback is from a HDR video content.
        type: boolean
    expires: never

  device_hardware_decoder_support:
    type: labeled_boolean
    description:
      The results of hardware decoder support for different video codecs. True
      means that codec can be decoded by hardware on user's device.
    metadata:
      tags:
        - 'Core :: Audio/Video: Playback'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1892516
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1892516#c4
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    labels:
      - h264
      - vp8
      - vp9
      - av1
      - hevc
    telemetry_mirror: MEDIA_DEVICE_HARDWARE_DECODING_SUPPORT
  not_supported_video_per_mime_type:
    type: labeled_counter
    description:
      Count the amount of times where video playback is failed to start due to the mime type is not supported by Firefox. The result is accumulated per mime type, eg. video/hevc.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1893523
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1893523#c9
    notification_emails:
      - media-alerts@mozilla.com
    expires: never

  unencrypted_sw_decode_error:
    type: dual_labeled_counter
    description: >
      Count of decode errors for unencrypted software media playback,
      keyed by codec and error name. Only fires when the decoder gives up
      after exhausting retries. Does not cover encrypted (EME) playback; see
      media.playback.encrypted_decode_error for that.
    metadata:
      tags:
        - 'Core :: Audio/Video: Playback'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1929335
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1929335
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    dual_labels:
      key:
        description: The codec mime type of the media track when the error occurred.
        labels:
          - video_avc
          - video_av1
          - video_vp9
          - video_vp8
          - video_hevc
          - video_theora
          - audio_mpeg
          - audio_opus
          - audio_flac
          - audio_vorbis
          - audio_wave
          - audio_other
          - video_other
      category:
        description: The name of the error.
        labels:
          - decode_err
          - fatal_err
          - metadata_err
          - demuxer_err
          - crash
          - unexpected_err
          - oom_err
          - other
    expires: never

  unencrypted_hw_decode_error:
    type: dual_labeled_counter
    description: >
      Count of decode errors for unencrypted hardware-accelerated media
      playback, keyed by codec and error name. Only fires when the decoder
      gives up after exhausting retries. Tracked separately from software
      errors to measure hw decoder failure rates and inform decisions on
      whether to retain this probe long-term.
    metadata:
      tags:
        - 'Core :: Audio/Video: Playback'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    dual_labels:
      key:
        description: The codec mime type of the media track when the error occurred.
        labels:
          - video_avc
          - video_av1
          - video_vp9
          - video_vp8
          - video_hevc
          - video_theora
          - audio_mpeg
          - audio_opus
          - audio_flac
          - audio_vorbis
          - audio_wave
          - audio_other
          - video_other
      category:
        description: The name of the error.
        labels:
          - decode_err
          - fatal_err
          - metadata_err
          - demuxer_err
          - crash
          - unexpected_err
          - oom_err
          - other
    expires: never

  encrypted_decode_error:
    type: dual_labeled_counter
    description: >
      Count of fatal decode errors for encrypted (EME) media playback, keyed
      by codec and key system. Only fires when the decoder gives up after
      exhausting retries.
    metadata:
      tags:
        - 'Core :: Audio/Video: Playback'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    dual_labels:
      key:
        description: The codec mime type of the media track when the error occurred.
        labels:
          - video_avc
          - video_av1
          - video_vp9
          - video_hevc
          - audio_aac
          - audio_other
          - video_other
      category:
        description: The key system in use when the error occurred.
        labels:
          - widevine
          - playready
          - clearkey
    expires: never

media.recorder:
  mime_type_query:
    type: labeled_counter
    description: >
      Count the amount of times where a mime type is queried via
      MediaRecorder.isTypeSupported() or passed to the MediaRecorder constructor.
      The result is accumulated per mime type.
    labels:
      - mp4_av1
      - mp4_h264
      - mp4_h265
      - mp4_vp9
      - mp4_aac
      - mp4_flac
      - mp4_opus
      - mp4_unspecified # no codec specified (codecs string is empty but valid)
      - mp4_others # invalid/unrecognized codec
      - webm_av1
      - webm_vp8
      - webm_vp9
      - webm_opus
      - webm_vorbis
      - webm_unspecified # no codec specified (codecs string is empty but valid)
      - webm_others # invalid codec
      - mkv_av1
      - mkv_h264
      - mkv_h265
      - mkv_vp8
      - mkv_vp9
      - mkv_aac
      - mkv_flac
      - mkv_opus
      - mkv_pcm
      - mkv_vorbis
      - mkv_unspecified # no codec specified (codecs string is empty but valid)
      - mkv_others # invalid/unrecognized codec
      - ogg_vp8
      - ogg_vp9
      - ogg_flac
      - ogg_opus
      - ogg_vorbis
      - ogg_unspecified # no codec specified (codecs string is empty but valid)
      - ogg_others # invalid/unrecognized codec
      - empty # The whole MIME string is empty but valid
      - others # invalid container
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1986763
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1986763
    notification_emails:
      - media-alerts@mozilla.com
    expires: never

media:
  element_in_page_count:
    type: counter
    description: >
      The number of times a document hierarchy contained at least one
      HTMLMediaElement. In addition, the telemetry probe
      'MIXED_CONTENT_UNBLOCK_COUNTER' records the total number of loaded
      top level content documents, which can help us calculate the result
      of the percentage of documents using media.
      This metric was generated to correspond to the Legacy Telemetry
      scalar media.element_in_page_count.
    bugs:
      - https://bugzil.la/1476456
      - https://bugzil.la/1499803
      - https://bugzil.la/1570634
      - https://bugzil.la/1652108
    data_reviews:
      - https://bugzil.la/1476456
      - https://bugzil.la/1499803
      - https://bugzil.la/1570634
      - https://bugzil.la/1652108
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: MEDIA_ELEMENT_IN_PAGE_COUNT

  mkv_content_count:
    type: counter
    description: >
      The number of times MKV content is detected as a source for media playback.
      This metric does not determine whether the MKV file is valid; it is simply
      a count based on the sniffed MIME type.
    bugs:
      - https://bugzil.la/2016198
    data_reviews:
      - https://bugzil.la/2016198
    notification_emails:
      - media-alerts@mozilla.com
    expires: 156

  mkv_codec_type:
    type: labeled_counter
    description: >
      Count the amount of the real world codec usage inside Matroska.
    labels:
      - VideoAv1
      - VideoAvc
      - VideoHevc
      - VideoVp8
      - VideoVp9
      - AudioAac
      - AudioMp3
      - AudioOpus
      - AudioVorbis
      - AudioFlac
      - AudioPcm
      - NoCodecSpecified
    bugs:
      - https://bugzil.la/2016198
    data_reviews:
      - https://bugzil.la/2016198
    notification_emails:
      - media-alerts@mozilla.com
    expires: 156

  video_hardware_decoding_support:
    type: labeled_boolean
    description: >
      Record whether hardware decoding is supported for the specific video
      codec. The key is the type of video codec, eg. video/vp9.
      This metric was generated to correspond to the Legacy Telemetry
      scalar media.video_hardware_decoding_support.
    metadata:
      permit_non_commutative_operations_over_ipc: true
    bugs:
      - https://bugzil.la/1733722
      - https://bugzil.la/1754657
      - https://bugzil.la/1811157
    data_reviews:
      - https://bugzil.la/1733722
      - https://bugzil.la/1754657
      - https://bugzil.la/1811157
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: MEDIA_VIDEO_HARDWARE_DECODING_SUPPORT

  video_hd_hardware_decoding_support:
    type: labeled_boolean
    description: >
      Record whether hardware decoding is supported for the specific video
      codec, this only records video in HD (1280*720) or higher resultion.
      The key is the type of video codec, eg. video/vp9.
      This metric was generated to correspond to the Legacy Telemetry
      scalar media.video_hd_hardware_decoding_support.
    metadata:
      permit_non_commutative_operations_over_ipc: true
    bugs:
      - https://bugzil.la/1741286
      - https://bugzil.la/1754657
      - https://bugzil.la/1811157
    data_reviews:
      - https://bugzil.la/1741286
      - https://bugzil.la/1754657
      - https://bugzil.la/1811157
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: MEDIA_VIDEO_HD_HARDWARE_DECODING_SUPPORT

  error:
    type: dual_labeled_counter
    description: >
      Count of errors surfaced on a media element, keyed by error type and
      whether the playback is encrypted. Serves as a high-level signal for
      all media error categories.
    metadata:
      tags:
        - 'Core :: Audio/Video: Playback'
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1929335
      - https://bugzilla.mozilla.org/show_bug.cgi?id=2021157
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1929335
    data_sensitivity:
      - technical
    notification_emails:
      - media-alerts@mozilla.com
    dual_labels:
      key:
        description: The error type as defined by the HTML MediaError spec.
        labels:
          - abort_error
          - network_error
          - decode_error
          - not_supported_error
      category:
        description: Whether the media playback is encrypted.
        labels:
          - encrypted
          - non_encrypted
    expires: never

  video_play_time:
    type: timing_distribution
    description: >
      Total time spent playing video in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1261955
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1127646
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1567604
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1261955
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1127646
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1567604
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_PLAY_TIME_MS

  media_play_time:
    type: labeled_timing_distribution
    description: >
      Total time spent playing media in milliseconds, keyed by its content
      (Audio and video, audio only, video only, audio and video but audio
      inaudible, audio and video but audio muted).

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram MEDIA_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678373
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678373
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: MEDIA_PLAY_TIME_MS

  audible_play_time_percent:
    type: labeled_custom_distribution
    description: >
      Percentage of time spent playing media with an audible audio track,
      regardless of the volume. Keyed by audio-only or video presence.

      This metric was generated to correspond to the Legacy Telemetry linear
      histogram AUDIBLE_PLAY_TIME_PERCENT.
    range_min: 1
    range_max: 100
    bucket_count: 50
    histogram_type: linear
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678373
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678373
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: AUDIBLE_PLAY_TIME_PERCENT

  muted_play_time_percent:
    type: labeled_custom_distribution
    description: >
      Percentage of time spent playing media that has an audio track, with the
      audio muted. Keyed by audio-only or video presence.

      This metric was generated to correspond to the Legacy Telemetry linear
      histogram MUTED_PLAY_TIME_PERCENT.
    range_min: 1
    range_max: 100
    bucket_count: 50
    histogram_type: linear
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678373
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1678373
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: MUTED_PLAY_TIME_PERCENT

  video_visible_play_time:
    type: labeled_timing_distribution
    description: >
      Total time spent playing visible video in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_VISIBLE_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1723799
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1723799
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_VISIBLE_PLAY_TIME_MS

  video_hidden_play_time:
    type: timing_distribution
    description: >
      Total time spent playing video while element is hidden, in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_HIDDEN_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1285419
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1285419
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_HIDDEN_PLAY_TIME_MS

  video_hidden_play_time_percentage:
    type: labeled_custom_distribution
    description: >
      Percentage of total time spent playing video while element is hidden.
      Keyed by audio presence and by height ranges (boundaries: 240. 480, 576,
      720, 1080, 2160), e.g.: 'V,0<h<=240', 'AV,h>2160'; and 'All' will
      accumulate all percentages. This is reported whenever the decoder stops.
      (eg. pausing media, encountering an error, changing to a new resource,
      page goes to the bf-cached or page gets discarded)

      This metric was generated to correspond to the Legacy Telemetry linear
      histogram VIDEO_HIDDEN_PLAY_TIME_PERCENTAGE.
    range_min: 1
    range_max: 100
    bucket_count: 50
    histogram_type: linear
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1287987
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1287987
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_HIDDEN_PLAY_TIME_PERCENTAGE

  video_hdr_play_time:
    type: timing_distribution
    description: >
      Total time spent playing HDR video in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_HDR_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1777264
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1777264
    notification_emails:
      - media-alerts@mozilla.com
      - bwerth@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_HDR_PLAY_TIME_MS

  video_encrypted_play_time:
    type: timing_distribution
    description: >
      Total time spent playing encrypted video in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_ENCRYPTED_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662212
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662212
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_ENCRYPTED_PLAY_TIME_MS

  video_clearkey_play_time:
    type: timing_distribution
    description: >
      Total time spent playing Clearkey encrypted video in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_CLEARKEY_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662212
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662212
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_CLEARKEY_PLAY_TIME_MS

  video_widevine_play_time:
    type: timing_distribution
    description: >
      Total time spent playing Widevine encrypted video in milliseconds.

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_WIDEVINE_PLAY_TIME_MS.
    time_unit: millisecond
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662212
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1662212
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1685399
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_WIDEVINE_PLAY_TIME_MS

  video_dropped_frames_proportion:
    type: custom_distribution
    description: >
      Percentage of frames decoded frames dropped between starting and stopping
      a video

      This metric was generated to correspond to the Legacy Telemetry linear
      histogram VIDEO_DROPPED_FRAMES_PROPORTION.
    range_min: 1
    range_max: 100
    bucket_count: 50
    histogram_type: linear
    unit: percentage
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1238433
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1238433
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_DROPPED_FRAMES_PROPORTION

  video_dropped_frames_proportion_exponential:
    type: custom_distribution
    description: >
      Ratio of dropped frames per total decoded frames scaled by 10,000 between
      starting and stopping a video

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_DROPPED_FRAMES_PROPORTION_EXPONENTIAL.
    range_min: 1
    range_max: 10000
    bucket_count: 100
    histogram_type: exponential
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1238433
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1752207
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1755363
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1238433
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1570634
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1752207
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1755363
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_DROPPED_FRAMES_PROPORTION_EXPONENTIAL

  video_dropped_decoded_frames_proportion_exponential:
    type: custom_distribution
    description: >
      Ratio of decoder dropped frames per total decoded frames scaled by 10,000
      between starting and stopping a video

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_DROPPED_DECODED_FRAMES_PROPORTION_EXPONENTIAL.
    range_min: 1
    range_max: 10000
    bucket_count: 100
    histogram_type: exponential
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1761994
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1761994
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_DROPPED_DECODED_FRAMES_PROPORTION_EXPONENTIAL

  video_dropped_sink_frames_proportion_exponential:
    type: custom_distribution
    description: >
      Ratio of sink dropped frames per total decoded frames scaled by 10,000
      between starting and stopping a video

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram VIDEO_DROPPED_SINK_FRAMES_PROPORTION_EXPONENTIAL.
    range_min: 1
    range_max: 10000
    bucket_count: 100
    histogram_type: exponential
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1761994
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1761994
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_DROPPED_SINK_FRAMES_PROPORTION_EXPONENTIAL

  video_dropped_compositor_frames_proportion_exponential:
    type: custom_distribution
    description: >
      Ratio of compositor dropped frames per total decoded frames scaled by
      10,000 between starting and stopping a video

      This metric was generated to correspond to the Legacy Telemetry
      exponential histogram
      VIDEO_DROPPED_COMPOSITOR_FRAMES_PROPORTION_EXPONENTIAL.
    range_min: 1
    range_max: 10000
    bucket_count: 100
    histogram_type: exponential
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1761994
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1761994
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: VIDEO_DROPPED_COMPOSITOR_FRAMES_PROPORTION_EXPONENTIAL

  codec_used:
    type: labeled_counter
    description: >
      Count of use of audio/video codecs in HTMLMediaElements and WebAudio.
      Those with 'resource' prefix are approximate; report based on HTTP
      ContentType or sniffing. Those with 'webaudio' prefix are for WebAudio.

      This metric was generated to correspond to the Legacy Telemetry count
      histogram MEDIA_CODEC_USED.
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1935420
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: h#MEDIA_CODEC_USED

  mse_source_buffer_type:
    type: labeled_counter
    description: >
      Count the actual or possible (because we don't support some of them for
      now) usage amount for each media mime type used in MSE. We collect this
      data in MediaSource's `AddSourceBuffer()` and `IsTypeSupported()`.

      This metric was generated to correspond to the Legacy Telemetry
      categorical histogram MSE_SOURCE_BUFFER_TYPE.
    labels:
      - VideoHevc
      - VideoWebm
      - AudioWebm
      - VideoMp4
      - AudioMp4
      - VideoMp2t
      - AudioMp2t
      - AudioMpeg
      - AudioAac
    bugs:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1699249
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1848211
    data_reviews:
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1699249
      - https://bugzilla.mozilla.org/show_bug.cgi?id=1848211
    notification_emails:
      - media-alerts@mozilla.com
    expires: never
    telemetry_mirror: h#MSE_SOURCE_BUFFER_TYPE

  capture_stream_usage:
    type: labeled_counter
    description: >
      Count the usage of MediaStream captured from HTMLMediaElement by different
      capture methods.
    labels:
      - CaptureStream
      - MozCaptureStream
      - MozCaptureStreamUntilEnded
      - MozAudioCaptured
      - AudioSourceNodeCaptured
      - WindowAudioCaptured
    bugs:
      - https://bugzil.la/2007596
    data_reviews:
      - https://bugzil.la/2007596
    notification_emails:
      - media-alerts@mozilla.com
    expires: 159
