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.
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";
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.
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);
45 // Called when a playback ends in error. The status is reported to UKM when
46 // the provider is destructed.
47 OnError(PipelineStatus status);
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);
55 // Setters for various one-time lazily generated metrics or properties.
59 SetTimeToMetadata(mojo_base.mojom.TimeDelta elapsed);
60 SetTimeToFirstFrame(mojo_base.mojom.TimeDelta elapsed);
61 SetTimeToPlayReady(mojo_base.mojom.TimeDelta elapsed);
63 // Sets the RendererType used in the playback.
64 SetRendererType(RendererType renderer_type);
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
69 SetKeySystem(string key_system);
71 // Called when the EME playback uses a hardware secure pipeline.
72 SetIsHardwareSecure();
74 // For src= playbacks, this is the container (".mp4", ".webm", etc).
75 SetContainerName(MediaContainerName container_name);
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);
82 // Creates a VideoDecodeStatsRecorder instance.
83 AcquireVideoDecodeStatsRecorder(
84 pending_receiver<VideoDecodeStatsRecorder> recorder);
86 // Returns a LearningTaskController for the given |taskName|.
87 AcquireLearningTaskController(
89 pending_receiver<media.learning.mojom.LearningTaskController> controller);
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);
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);