1/*
2 * Copyright (C) 2019 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;
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: 26
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    optional int32 bitrate = 24;
161    optional int64 lifetime_millis = 25;
162}
163
164/**
165 * Track Media Extractor (pulling video/audio streams out of containers) usage
166 * Logged from:
167 *   frameworks/av/media/libstagefright/RemoteMediaExtractor.cpp
168 *   frameworks/av/services/mediaanalytics/statsd_extractor.cpp
169 * Next Tag: 4
170 */
171message ExtractorData {
172    optional string format = 1;
173    optional string mime = 2;
174    optional int32 tracks = 3;
175}
176
177/**
178 * Track Media Player usage
179 * this handles both nuplayer and nuplayer2
180 * Logged from:
181 *   frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
182 *   frameworks/av/media/libmediaplayer2/nuplayer2/NuPlayer2Driver.cpp
183 *   frameworks/av/services/mediaanalytics/statsd_nuplayer.cpp
184 * Next Tag: 21
185 */
186message NuPlayerData {
187    optional string whichPlayer = 1;
188
189    optional string video_mime = 2;
190    optional string video_codec = 3;
191    optional int32 width = 4;
192    optional int32 height = 5;
193    optional int64 frames = 6;
194    optional int64 frames_dropped = 7;
195    optional double framerate = 8;
196    optional string audio_mime = 9;
197    optional string audio_codec = 10;
198    optional int64 duration_millis = 11;
199    optional int64 playing_millis = 12;
200    optional int32 error = 13;
201    optional int32 error_code = 14;
202    optional string error_state = 15;
203    optional string data_source_type = 16;
204    optional int64 rebuffering_millis = 17;
205    optional int32 rebuffers = 18;
206    optional int32 rebuffer_at_exit = 19;
207    optional int64 frames_dropped_startup = 20;
208}
209
210/**
211 * Track information about recordings (e.g. camcorder)
212 * Logged from
213 *   frameworks/av/media/libmediaplayerservice/StagefrightRecorder.cpp
214 *   frameworks/av/services/mediaanalytics/if_statsd.cpp
215 * Next Tag: 22
216 */
217message RecorderData {
218    optional string audio_mime = 1;
219    optional string video_mime = 2;
220    optional int32 video_profile = 3;
221    optional int32 video_level = 4;
222    optional int32 width = 5;
223    optional int32 height = 6;
224    optional int32 rotation = 7;
225    optional int32 framerate = 8;
226    optional int32 capture_fps = 9;
227    optional double capture_fps_enable = 10;
228    optional int64 duration_millis = 11;
229    optional int64 paused_millis = 12;
230    optional int32 paused_count = 13;
231    optional int32 audio_bitrate = 14;
232    optional int32 audio_channels = 15;
233    optional int32 audio_samplerate = 16;
234    optional int32 movie_timescale = 17;
235    optional int32 audio_timescale = 18;
236    optional int32 video_timescale = 19;
237    optional int32 video_bitrate = 20;
238    optional int32 iframe_interval = 21;
239}
240