[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / webrtc_video_perf.mojom
1 // Copyright 2022 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.
4
5 module media.mojom;
6
7 import "media/mojo/mojom/media_types.mojom";
8
9 // WebRTC prediction features that represent a video configuration.
10 struct WebrtcPredictionFeatures {
11   bool is_decode_stats = true;
12   // Not possible to have a default initialization for native enums.
13   VideoCodecProfile profile;
14   int32 video_pixels = 0;
15   bool hardware_accelerated = false;
16 };
17
18 // WebRTC video stats that are collected and stored for for MediaCapabilities
19 // smoothness predictions.
20 struct WebrtcVideoStats {
21   uint32 frames_processed = 0;
22   uint32 key_frames_processed = 0;
23   // The 99 percentile of the processing time.
24   float p99_processing_time_ms = 0;
25 };
26
27 // This interface allows forwarding WebRTC encode and decode statistics to the
28 // browser process where they are stored in a local database.
29 interface WebrtcVideoPerfRecorder {
30   // Update stats values for the specified features. Each update overrides the
31   // previous values.
32   UpdateRecord(
33     WebrtcPredictionFeatures features, WebrtcVideoStats video_stats);
34 };
35
36 // This interface allows retrieving a smoothness prediction based on historical
37 // performance for the specified video configuration.
38 interface WebrtcVideoPerfHistory {
39   // Get a performance prediction `is_smooth` based on the specified `features`
40   // and `frames_per_second`.
41   GetPerfInfo(WebrtcPredictionFeatures features, int32 frames_per_second)
42     => (bool is_smooth);
43 };