[M120 Migration][MM] Framerate calculation
[platform/framework/web/chromium-efl.git] / media / mojo / mojom / media_metrics_provider.mojom
1 // Copyright 2017 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/learning/mojo/public/mojom/learning_task_controller.mojom";
8 import "media/mojo/mojom/media_types.mojom";
9 import "media/mojo/mojom/video_decode_stats_recorder.mojom";
10 import "media/mojo/mojom/playback_events_recorder.mojom";
11 import "media/mojo/mojom/watch_time_recorder.mojom";
12 import "mojo/public/mojom/base/time.mojom";
13
14 // Used for reporting to UMA and UKM. Represents the URL scheme of the src URL
15 // given to an <audio> or <video> tag. Always add new entries to the end.
16 enum MediaURLScheme {
17   kUnknown = 0,
18   kMissing,
19   kHttp,
20   kHttps,
21   kFtp,
22   kChromeExtension,
23   kJavascript,
24   kFile,
25   kBlob,
26   kData,
27   kFileSystem,
28   kChrome,
29   kContent,
30   kContentId,
31 };
32
33 // Provider interface used to avoid having one time setters on each interface.
34 // Each recorder will be stamped with an ID which can be used for linking UKM.
35 interface MediaMetricsProvider {
36   // Assigns a playback ID and sets up this provider instance with information
37   // needed to make UKM reports. No other methods may be called until after
38   // Initialize() has been called. |url_scheme| is only used if |!is_mse|.
39   // If |stream_type| is one of the MediaStream types (i.e., not kNone),
40   // UMA metrics are not recorded.
41   Initialize(bool is_mse,
42              MediaURLScheme url_scheme,
43              MediaStreamType stream_type);
44
45   // Called when a playback ends in error. The status is reported to UKM when
46   // the provider is destructed.
47   OnError(PipelineStatus status);
48
49   // Called when some portion of the pipeline wants to report a non-fatal error,
50   // such as hardware decode failure that falls back to a successful software
51   // decoded playback session, or a failed hardware renderer path which falls
52   // back to a successful software one.
53   OnFallback(PipelineStatus status);
54
55   // Setters for various one-time lazily generated metrics or properties.
56   SetHasPlayed();
57   SetHaveEnough();
58   SetIsEME();
59   SetTimeToMetadata(mojo_base.mojom.TimeDelta elapsed);
60   SetTimeToFirstFrame(mojo_base.mojom.TimeDelta elapsed);
61   SetTimeToPlayReady(mojo_base.mojom.TimeDelta elapsed);
62
63   // Sets the RendererType used in the playback.
64   SetRendererType(RendererType renderer_type);
65
66   // Sets the EME key system used for an EME playback. For clear playback, or if
67   // the `key_system` is not recognized, value 0 (kUnknownKeySystemForUkm) will
68   // be reported.
69   SetKeySystem(string key_system);
70
71   // Called when the EME playback uses a hardware secure pipeline.
72   SetIsHardwareSecure();
73
74   // For src= playbacks, this is the container (".mp4", ".webm", etc).
75   SetContainerName(MediaContainerName container_name);
76
77   // Creates a WatchTimeRecorder instance using |properties|. If any of those
78   // properties changes, a new recorder should be requested.
79   AcquireWatchTimeRecorder(PlaybackProperties properties,
80                            pending_receiver<WatchTimeRecorder> recorder);
81
82   // Creates a VideoDecodeStatsRecorder instance.
83   AcquireVideoDecodeStatsRecorder(
84       pending_receiver<VideoDecodeStatsRecorder> recorder);
85
86   // Returns a LearningTaskController for the given |taskName|.
87   AcquireLearningTaskController(
88       string taskName,
89       pending_receiver<media.learning.mojom.LearningTaskController> controller);
90
91   // Returns a PlaybackEventsRecorder instance. Implementation may drop the
92   // |receiver| if it's not interested in recording playback events.
93   AcquirePlaybackEventsRecorder(
94        pending_receiver<PlaybackEventsRecorder> receiver);
95
96   // Can be called multiple times to set properties about a playback.
97   SetHasAudio(AudioCodec codec);
98   SetHasVideo(VideoCodec codec);
99   SetVideoPipelineInfo(VideoPipelineInfo info);
100   SetAudioPipelineInfo(AudioPipelineInfo info);
101 };