1 // Copyright 2023 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 import "ui/gfx/geometry/mojom/geometry.mojom";
8 import "media/mojo/mojom/media_types.mojom";
10 // These values are persisted to logs. Entries should not be renumbered and
11 // numeric values should never be reused. Please keep the consistency with
12 // VideoEncoderUseCase in tools/metrics/histograms/enums.xml.
13 enum VideoEncoderUseCase {
20 // Provider interface to collect video encoder metrics.
21 interface VideoEncoderMetricsProvider {
22 // Initialize() is called whenever the encoder configuration is changed for
23 // the encoder whose id is |encoder_id|. This must be called for a new encoder
24 // before other calls. Otherwise, the other functions for the encoder is
26 // The UKM about the encoding represented by the previous Initialize() is
27 // reported if SetEncodedFrameCount() or SetError() is invoked. See
28 // Media.VideoEncoderMetrics in ukm.xml for the detail about the recorded UKM.
29 Initialize(uint64 encoder_id, VideoEncoderUseCase encoder_use_case,
30 VideoCodecProfile profile, gfx.mojom.Size encode_size,
31 bool is_hardware_encoder, SVCScalabilityMode svc_mode);
33 // SetEncodedFramesCount() updates the number of successfully encoded frames.
34 // |num_encoded_frames| can be any value, but it is bucket by 100 when UKM
36 SetEncodedFrameCount(uint64 encoder_id, uint64 num_encoded_frames);
38 // SetError() should be called when the encoder becomes in the error state. In
39 // other words, |status| must not be kOk.
40 SetError(uint64 encoder_id, EncoderStatus status);
42 // Complete() is called when if the encoder whose id |encoder_id| is no longer
43 // used. This may not be called if the encoder is destroyed by destroying
44 // the renderer process (e.g. closing the tab).
45 Complete(uint64 encoder_id);