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