1/*
2 * Copyright (C) 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.stats.mediametrics_message;
20
21/**
22 * Track how we arbitrate between microphone/input requests.
23 * Logged from
24 *   frameworks/av/services/audiopolicy/service/AudioPolicyInterfaceImpl.cpp
25 *   frameworks/av/services/mediaanalytics/statsd_audiopolicy.cpp
26 * Next Tag: 10
27 */
28message AudioPolicyData {
29    optional int32 status = 1;
30    optional string request_source = 2;
31    optional string request_package = 3;
32    optional int32 request_session = 4;
33    optional string request_device = 5;
34    optional string active_source = 6;
35    optional string active_package = 7;
36    optional int32 active_session = 8;
37    optional string active_device = 9;
38}
39
40/**
41 * Track properties of audio recording
42 * Logged from
43 *   frameworks/av/media/libaudioclient/AudioRecord.cpp
44 *   frameworks/av/services/mediaanalytics/statsd_audiorecord.cpp
45 * Next Tag: 16
46 */
47message AudioRecordData {
48    optional string encoding = 1;
49    optional string source = 2;
50    optional int32 latency = 3;
51    optional int32 samplerate = 4;
52    optional int32 channels = 5;
53    optional int64 created_millis = 6;
54    optional int64 duration_millis = 7;
55    optional int32 count = 8;
56    optional int32 error_code = 9;
57    optional string error_function = 10;
58    optional int32 port_id = 11;
59    optional int32 frame_count = 12;
60    optional string attributes = 13;
61    optional int64 channel_mask = 14;
62    optional int64 start_count = 15;
63
64}
65
66/**
67 * Track audio thread performance data
68 * Logged from
69 *   frameworks/av/media/libnblog/ReportPerformance.cpp
70 *   frameworks/av/services/mediaanalytics/statsd_audiothread.cpp
71 * Next Tag: 28
72 */
73message AudioThreadData {
74    optional string type = 1;
75    optional int32 framecount = 2;
76    optional int32 samplerate = 3;
77    optional string work_millis_hist = 4;
78    optional string latency_millis_hist = 5;
79    optional string warmup_millis_hist = 6;
80    optional int64 underruns = 7;
81    optional int64 overruns = 8;
82    optional int64 active_millis = 9;
83    optional int64 duration_millis = 10;
84
85    optional int32 id = 11;
86    optional int32 port_id = 12;
87    optional int32 sample_rate = 13;
88    optional int64 channel_mask = 14;
89    optional string encoding = 15;
90    optional int32 frame_count = 16;
91    optional string output_device = 17;
92    optional string input_device = 18;
93    optional double io_jitter_mean_millis = 19;
94    optional double io_jitter_stddev_millis = 20;
95    optional double process_time_mean_millis = 21;
96    optional double process_time_stddev_millis = 22;
97    optional double timestamp_jitter_mean_millis = 23;
98    optional double timestamp_jitter_stddev_millis = 24;
99    optional double latency_mean_millis = 25;
100    optional double latency_stddev_millis = 26;
101
102}
103
104/**
105 * Track audio track playback data
106 * Logged from
107 *   frameworks/av/media/libaudioclient/AudioTrack.cpp
108 *   frameworks/av/services/mediaanalytics/statsd_audiotrack.cpp
109 * Next Tag: 12
110 */
111message AudioTrackData {
112    optional string stream_type = 1;
113    optional string content_type = 2;
114    optional string track_usage = 3;
115    optional int32 sample_rate = 4;
116    optional int64 channel_mask = 5;
117
118    optional int32 underrun_frames = 6;
119    optional int32 startup_glitch = 7;
120
121    optional int32 port_id = 8;
122    optional string encoding = 9;
123    optional int32 frame_count = 10;
124    optional string attributes = 11;
125
126
127}
128
129/**
130 * Track Media Codec usage
131 * Logged from:
132 *   frameworks/av/media/libstagefright/MediaCodec.cpp
133 *   frameworks/av/services/mediaanalytics/statsd_codec.cpp
134 * Next Tag: 75
135 */
136message CodecData {
137  optional string codec = 1;
138  optional string mime = 2;
139  optional string mode = 3;
140  optional int32 encoder = 4;
141  optional int32 secure = 5;
142  optional int32 width = 6;
143  optional int32 height = 7;
144  optional int32 rotation = 8;
145  optional int32 crypto = 9;
146  optional int32 profile = 10;
147  optional int32 level = 11;
148  optional int32 max_width = 12;
149  optional int32 max_height = 13;
150  optional int32 error_code = 14;
151  optional string error_state = 15;
152  optional int64 latency_max = 16;
153  optional int64 latency_min = 17;
154  optional int64 latency_avg = 18;
155  optional int64 latency_count = 19;
156  optional int64 latency_unknown = 20;
157  optional int32 queue_input_buffer_error = 21;
158  optional int32 queue_secure_input_buffer_error = 22;
159  optional string bitrate_mode = 23;
160  // The bitrate presented to the underlying codec, after any modifications by
161  // the framework to ensure a minimum quality.
162  // If the framework changed this, the app-requested bitrate is in
163  // original_bitrate.
164  optional int32 bitrate = 24;
165  optional int64 lifetime_millis = 25;
166  optional string log_session_id = 26;
167  optional int32 channel_count = 27;
168  optional int32 sample_rate = 28;
169  // Total bytes produced by an encoder. When divided by video_encode_duration_us
170  // this yields the encoding's realized bitrate.
171  optional int64 video_encode_bytes = 29;
172  optional int64 video_encode_frames = 30;
173  optional int64 video_input_bytes = 31;
174  optional int64 video_input_frames = 32;
175  // The duration of the encoded video; NOT the encoding process duration
176  optional int64 video_encode_duration_us = 33;
177  optional int32 color_format = 34;
178  optional double frame_rate = 35;
179  optional double capture_rate = 36;
180  optional double operating_rate = 37;
181  optional int32 priority = 38;
182  optional int32 video_qp_i_min = 39;
183  optional int32 video_qp_i_max = 40;
184  optional int32 video_qp_p_min = 41;
185  optional int32 video_qp_p_max = 42;
186  optional int32 video_qp_b_min = 43;
187  optional int32 video_qp_b_max = 44;
188  // The app-requested bitrate, present only if the framework modified the
189  // bitrate before passing it to the underlying codec.
190  optional int32 original_bitrate = 45;
191  optional int32 shaping_enhanced = 46;
192  optional int32 original_video_qp_i_min = 47;
193  optional int32 original_video_qp_i_max = 48;
194  optional int32 original_video_qp_p_min = 49;
195  optional int32 original_video_qp_p_max = 50;
196  optional int32 original_video_qp_b_min = 51;
197  optional int32 original_video_qp_b_max = 52;
198  optional int32 config_color_standard = 53;
199  optional int32 config_color_range = 54;
200  optional int32 config_color_transfer = 55;
201  optional int32 parsed_color_standard = 56;
202  optional int32 parsed_color_range = 57;
203  optional int32 parsed_color_transfer = 58;
204  optional int32 hdr_static_info = 59;
205  optional int32 hdr10_plus_info = 60;
206  optional int32 hdr_format = 61;
207  // Randomly generated Codec ID for:
208  // - correlating MediaCodecStarted and MediaCodecStopped for
209  // more codec configuration parameters.
210  // @since U
211  optional int64 codec_id = 62;
212  optional int32 array_mode = 63;
213  optional int32 operation_mode = 64;
214  optional int32 output_surface = 65;
215  optional int32 app_max_input_size = 66;
216  optional int32 used_max_input_size = 67;
217  optional int32 codec_max_input_size = 68;
218  optional int32 flush_count = 69;
219  optional int32 set_surface_count = 70;
220  optional int32 resolution_change_count = 71;
221  optional int32 component_color_format = 72;
222  // caller uid (replacing packagename)
223  // @Since U-QPR2
224  optional int32 caller_uid = 73;
225  optional int64 pixel_format = 74;
226  // !!!WARNING!!!
227  // Keep synchronized with MediaCodecReported in atoms.proto
228  // Also keep AStatsEvent serialization synchronized in statsd_codec.cpp
229  // !!!WARNING!!!
230}
231
232/**
233 * Track Media Extractor (pulling video/audio streams out of containers) usage
234 * Logged from:
235 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
236 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
237 * Next Tag: 6
238 */
239message ExtractorData {
240  optional string format = 1;
241  optional string mime = 2;
242  optional int32 tracks = 3;
243
244  enum EntryPoint {
245    UNSET = 0; // For backwards compatibility with clients that don't
246               // collect the entry point.
247    SDK = 1;
248    NDK_WITH_JVM = 2;
249    NDK_NO_JVM = 3;
250    OTHER = 4; // For extractor users that don't make use of the APIs.
251  }
252
253  optional EntryPoint entry_point = 4 [default = UNSET];
254  optional string log_session_id = 5;
255}
256
257/**
258 * Track Media Player usage
259 * this handles both nuplayer and nuplayer2
260 * Logged from:
261 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
262 *   frameworks/av/media/libmediaplayer2/nuplayer2/NuPlayer2Driver.cpp
263 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
264 * Next Tag: 21
265 */
266message NuPlayerData {
267  optional string whichPlayer = 1;
268
269  optional string video_mime = 2;
270  optional string video_codec = 3;
271  optional int32 width = 4;
272  optional int32 height = 5;
273  optional int64 frames = 6;
274  optional int64 frames_dropped = 7;
275  optional double framerate = 8;
276  optional string audio_mime = 9;
277  optional string audio_codec = 10;
278  optional int64 duration_millis = 11;
279  optional int64 playing_millis = 12;
280  optional int32 error = 13;
281  optional int32 error_code = 14;
282  optional string error_state = 15;
283  optional string data_source_type = 16;
284  optional int64 rebuffering_millis = 17;
285  optional int32 rebuffers = 18;
286  optional int32 rebuffer_at_exit = 19;
287  optional int64 frames_dropped_startup = 20;
288}
289
290/**
291 * Track information about recordings (e.g. camcorder)
292 * Logged from
293 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
294 *   frameworks/av/services/mediaanalytics/if_statsd.cpp
295 * Next Tag: 23
296 */
297message RecorderData {
298  optional string audio_mime = 1;
299  optional string video_mime = 2;
300  optional int32 video_profile = 3;
301  optional int32 video_level = 4;
302  optional int32 width = 5;
303  optional int32 height = 6;
304  optional int32 rotation = 7;
305  optional int32 framerate = 8;
306  optional int32 capture_fps = 9;
307  optional double capture_fps_enable = 10;
308  optional int64 duration_millis = 11;
309  optional int64 paused_millis = 12;
310  optional int32 paused_count = 13;
311  optional int32 audio_bitrate = 14;
312  optional int32 audio_channels = 15;
313  optional int32 audio_samplerate = 16;
314  optional int32 movie_timescale = 17;
315  optional int32 audio_timescale = 18;
316  optional int32 video_timescale = 19;
317  optional int32 video_bitrate = 20;
318  optional int32 iframe_interval = 21;
319  optional string log_session_id = 22;
320}
321
322