Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 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 | |
| 17 | //#define LOG_NDEBUG 0 |
| 18 | #define LOG_TAG "statsd_codec" |
| 19 | #include <utils/Log.h> |
| 20 | |
| 21 | #include <dirent.h> |
| 22 | #include <inttypes.h> |
| 23 | #include <pthread.h> |
| 24 | #include <pwd.h> |
| 25 | #include <stdint.h> |
Brian Lindahl | 778b15a | 2023-05-13 07:42:13 -0600 | [diff] [blame^] | 26 | #include <string> |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 27 | #include <string.h> |
| 28 | #include <sys/stat.h> |
| 29 | #include <sys/time.h> |
| 30 | #include <sys/types.h> |
| 31 | #include <unistd.h> |
| 32 | |
Vova Sharaienko | f58455a | 2022-09-24 01:47:23 +0000 | [diff] [blame] | 33 | #include <stats_media_metrics.h> |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 34 | #include <stats_event.h> |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 35 | |
Brian Lindahl | 778b15a | 2023-05-13 07:42:13 -0600 | [diff] [blame^] | 36 | #include <frameworks/proto_logging/stats/message/mediametrics_message.pb.h> |
| 37 | #include <mediametricsservice/cleaner.h> |
| 38 | #include <mediametricsservice/iface_statsd.h> |
| 39 | #include <mediametricsservice/MediaMetricsService.h> |
| 40 | #include <mediametricsservice/StringUtils.h> |
| 41 | #include <mediametricsservice/ValidateId.h> |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 42 | |
| 43 | namespace android { |
| 44 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 45 | using stats::media_metrics::stats_write; |
| 46 | using stats::media_metrics::MEDIA_CODEC_RENDERED; |
| 47 | using stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_UNKNOWN; |
| 48 | using stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_INVALID; |
| 49 | using stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_ZERO; |
| 50 | using stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_UNKNOWN; |
| 51 | using stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_UNDETERMINED; |
| 52 | using stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_24_3_2_PULLDOWN; |
| 53 | using stats::media_metrics::MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_NONE; |
| 54 | using stats::media_metrics::MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_HLG; |
| 55 | using stats::media_metrics::MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_HDR10; |
| 56 | using stats::media_metrics::MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_HDR10_PLUS; |
| 57 | using stats::media_metrics::MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_DOLBY_VISION; |
| 58 | |
| 59 | static const int BITRATE_UNKNOWN = |
| 60 | stats::media_metrics::MEDIA_CODEC_RENDERED__BITRATE__BITRATE_UNKNOWN; |
| 61 | |
| 62 | static const std::pair<char const *, int> CODEC_LOOKUP[] = { |
| 63 | { "avc", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_AVC }, |
| 64 | { "h264", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_AVC }, |
| 65 | { "hevc", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_HEVC }, |
| 66 | { "h265", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_HEVC }, |
| 67 | { "vp8", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_VP8 }, |
| 68 | { "vp9", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_VP9 }, |
| 69 | { "av1", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_AV1 }, |
| 70 | { "av01", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_AV1 }, |
| 71 | { "dolby-vision", stats::media_metrics::MEDIA_CODEC_RENDERED__CODEC__CODEC_HEVC }, |
| 72 | }; |
| 73 | |
| 74 | static const int32_t RESOLUTION_LOOKUP[] = { |
| 75 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_MAX_SIZE, |
| 76 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_32K, |
| 77 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_16K, |
| 78 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_8K_UHD, |
| 79 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_8K_UHD_ALMOST, |
| 80 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_4K_UHD_ALMOST, |
| 81 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_1440X2560, |
| 82 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_1080X2400, |
| 83 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_1080X2340, |
| 84 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_1080P_FHD, |
| 85 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_1080P_FHD_ALMOST, |
| 86 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_720P_HD, |
| 87 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_720P_HD_ALMOST, |
| 88 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_576X1024, |
| 89 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_540X960, |
| 90 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_480X854, |
| 91 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_480X640, |
| 92 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_360X640, |
| 93 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_352X640, |
| 94 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_VERY_LOW, |
| 95 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_SMALLEST, |
| 96 | stats::media_metrics::MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_ZERO, |
| 97 | }; |
| 98 | |
| 99 | static const int32_t FRAMERATE_LOOKUP[] = { |
| 100 | stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_24, |
| 101 | stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_25, |
| 102 | stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_30, |
| 103 | stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_50, |
| 104 | stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_60, |
| 105 | stats::media_metrics::MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_120, |
| 106 | }; |
| 107 | |
| 108 | static int32_t getMetricsCodecEnum(const std::string &mime, const std::string &componentName) { |
| 109 | for (const auto & codecStrAndEnum : CODEC_LOOKUP) { |
| 110 | if (strcasestr(mime.c_str(), codecStrAndEnum.first) != nullptr || |
| 111 | strcasestr(componentName.c_str(), codecStrAndEnum.first) != nullptr) { |
| 112 | return codecStrAndEnum.second; |
| 113 | } |
| 114 | } |
| 115 | return MEDIA_CODEC_RENDERED__CODEC__CODEC_UNKNOWN; |
| 116 | } |
| 117 | |
| 118 | static int32_t getMetricsResolutionEnum(int32_t width, int32_t height) { |
| 119 | if (width == 0 || height == 0) { |
| 120 | return MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_ZERO; |
| 121 | } |
| 122 | int64_t pixels = int64_t(width) * height / 1000; |
| 123 | if (width < 0 || height < 0 || pixels > RESOLUTION_LOOKUP[0]) { |
| 124 | return MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_INVALID; |
| 125 | } |
| 126 | for (int32_t resolutionEnum : RESOLUTION_LOOKUP) { |
| 127 | if (pixels > resolutionEnum) { |
| 128 | return resolutionEnum; |
| 129 | } |
| 130 | } |
| 131 | return MEDIA_CODEC_RENDERED__RESOLUTION__RESOLUTION_ZERO; |
| 132 | } |
| 133 | |
| 134 | static int32_t getMetricsFramerateEnum(float inFramerate) { |
| 135 | if (inFramerate == -1.0f) { |
| 136 | return MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_UNDETERMINED; |
| 137 | } |
| 138 | if (inFramerate == -2.0f) { |
| 139 | return MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_24_3_2_PULLDOWN; |
| 140 | } |
| 141 | int framerate = int(inFramerate * 100); // Table is in hundredths of frames per second |
| 142 | static const int framerateTolerance = 40; // Tolerance is 0.4 frames per second - table is 100s |
| 143 | for (int32_t framerateEnum : FRAMERATE_LOOKUP) { |
| 144 | if (abs(framerate - framerateEnum) < framerateTolerance) { |
| 145 | return framerateEnum; |
| 146 | } |
| 147 | } |
| 148 | return MEDIA_CODEC_RENDERED__CONTENT_FRAMERATE__FRAMERATE_UNKNOWN; |
| 149 | } |
| 150 | |
| 151 | static int32_t getMetricsHdrFormatEnum(std::string &mime, std::string &componentName, |
| 152 | int32_t configColorTransfer, int32_t parsedColorTransfer, |
| 153 | int32_t hdr10StaticInfo, int32_t hdr10PlusInfo) { |
| 154 | if (hdr10PlusInfo) { |
| 155 | return MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_HDR10_PLUS; |
| 156 | } |
| 157 | if (hdr10StaticInfo) { |
| 158 | return MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_HDR10; |
| 159 | } |
| 160 | // 7 = COLOR_TRANSFER_HLG in MediaCodecConstants.h |
| 161 | if (configColorTransfer == 7 || parsedColorTransfer == 7) { |
| 162 | return MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_HLG; |
| 163 | } |
| 164 | if (strcasestr(mime.c_str(), "dolby-vision") != nullptr || |
| 165 | strcasestr(componentName.c_str(), "dvhe") != nullptr || |
| 166 | strcasestr(componentName.c_str(), "dvav") != nullptr || |
| 167 | strcasestr(componentName.c_str(), "dav1") != nullptr) { |
| 168 | return MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_DOLBY_VISION; |
| 169 | } |
| 170 | return MEDIA_CODEC_RENDERED__HDR_FORMAT__HDR_FORMAT_NONE; |
| 171 | } |
| 172 | |
| 173 | static void parseVector(const std::string &str, std::vector<int32_t> *vector) { |
Brian Lindahl | 778b15a | 2023-05-13 07:42:13 -0600 | [diff] [blame^] | 174 | if (!mediametrics::stringutils::parseVector(str, vector)) { |
| 175 | ALOGE("failed to parse integer vector from '%s'", str.c_str()); |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 176 | } |
| 177 | } |
| 178 | |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 179 | bool statsd_codec(const std::shared_ptr<const mediametrics::Item>& item, |
| 180 | const std::shared_ptr<mediametrics::StatsdLog>& statsdLog) |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 181 | { |
Andy Hung | 3ab1b32 | 2020-05-18 10:47:31 -0700 | [diff] [blame] | 182 | if (item == nullptr) return false; |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 183 | |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 184 | AStatsEvent* event = AStatsEvent_obtain(); |
Vova Sharaienko | f58455a | 2022-09-24 01:47:23 +0000 | [diff] [blame] | 185 | AStatsEvent_setAtomId(event, stats::media_metrics::MEDIA_CODEC_REPORTED); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 186 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 187 | const nsecs_t timestampNanos = MediaMetricsService::roundTime(item->getTimestamp()); |
| 188 | AStatsEvent_writeInt64(event, timestampNanos); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 189 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 190 | std::string packageName = item->getPkgName(); |
| 191 | AStatsEvent_writeString(event, packageName.c_str()); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 192 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 193 | int64_t packageVersionCode = item->getPkgVersionCode(); |
| 194 | AStatsEvent_writeInt64(event, packageVersionCode); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 195 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 196 | int64_t mediaApexVersion = 0; |
| 197 | AStatsEvent_writeInt64(event, mediaApexVersion); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 198 | |
| 199 | // the rest into our own proto |
| 200 | // |
Dichen Zhang | b8f23c5 | 2021-03-22 00:56:29 -0700 | [diff] [blame] | 201 | ::android::stats::mediametrics_message::CodecData metrics_proto; |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 202 | |
| 203 | // flesh out the protobuf we'll hand off with our data |
| 204 | // |
George Burgess IV | 0d81443 | 2019-10-23 11:32:26 -0700 | [diff] [blame] | 205 | std::string codec; |
| 206 | if (item->getString("android.media.mediacodec.codec", &codec)) { |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 207 | metrics_proto.set_codec(codec); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 208 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 209 | AStatsEvent_writeString(event, codec.c_str()); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 210 | |
George Burgess IV | 0d81443 | 2019-10-23 11:32:26 -0700 | [diff] [blame] | 211 | std::string mime; |
| 212 | if (item->getString("android.media.mediacodec.mime", &mime)) { |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 213 | metrics_proto.set_mime(mime); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 214 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 215 | AStatsEvent_writeString(event, mime.c_str()); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 216 | |
George Burgess IV | 0d81443 | 2019-10-23 11:32:26 -0700 | [diff] [blame] | 217 | std::string mode; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 218 | if (item->getString("android.media.mediacodec.mode", &mode)) { |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 219 | metrics_proto.set_mode(mode); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 220 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 221 | AStatsEvent_writeString(event, mode.c_str()); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 222 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 223 | int32_t isEncoder = -1; |
| 224 | if (item->getInt32("android.media.mediacodec.encoder", &isEncoder)) { |
| 225 | metrics_proto.set_encoder(isEncoder); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 226 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 227 | AStatsEvent_writeInt32(event, isEncoder); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 228 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 229 | int32_t isSecure = -1; |
| 230 | if (item->getInt32("android.media.mediacodec.secure", &isSecure)) { |
| 231 | metrics_proto.set_secure(isSecure); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 232 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 233 | AStatsEvent_writeInt32(event, isSecure); |
| 234 | |
| 235 | int32_t isHardware = -1; |
| 236 | item->getInt32("android.media.mediacodec.hardware", &isHardware); |
| 237 | // not logged to MediaCodecReported or MediametricsCodecReported |
| 238 | |
| 239 | int32_t isTunneled = -1; |
| 240 | item->getInt32("android.media.mediacodec.tunneled", &isTunneled); |
| 241 | // not logged to MediaCodecReported or MediametricsCodecReported |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 242 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 243 | int32_t width = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 244 | if (item->getInt32("android.media.mediacodec.width", &width)) { |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 245 | metrics_proto.set_width(width); |
| 246 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 247 | AStatsEvent_writeInt32(event, width); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 248 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 249 | int32_t height = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 250 | if (item->getInt32("android.media.mediacodec.height", &height)) { |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 251 | metrics_proto.set_height(height); |
| 252 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 253 | AStatsEvent_writeInt32(event, height); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 254 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 255 | int32_t rotation = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 256 | if (item->getInt32("android.media.mediacodec.rotation-degrees", &rotation)) { |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 257 | metrics_proto.set_rotation(rotation); |
| 258 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 259 | AStatsEvent_writeInt32(event, rotation); |
| 260 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 261 | int32_t crypto = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 262 | if (item->getInt32("android.media.mediacodec.crypto", &crypto)) { |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 263 | metrics_proto.set_crypto(crypto); |
| 264 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 265 | AStatsEvent_writeInt32(event, crypto); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 266 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 267 | int32_t profile = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 268 | if (item->getInt32("android.media.mediacodec.profile", &profile)) { |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 269 | metrics_proto.set_profile(profile); |
| 270 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 271 | AStatsEvent_writeInt32(event, profile); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 272 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 273 | int32_t level = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 274 | if (item->getInt32("android.media.mediacodec.level", &level)) { |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 275 | metrics_proto.set_level(level); |
| 276 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 277 | AStatsEvent_writeInt32(event, level); |
| 278 | |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 279 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 280 | int32_t maxWidth = -1; |
| 281 | if ( item->getInt32("android.media.mediacodec.maxwidth", &maxWidth)) { |
| 282 | metrics_proto.set_max_width(maxWidth); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 283 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 284 | AStatsEvent_writeInt32(event, maxWidth); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 285 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 286 | int32_t maxHeight = -1; |
| 287 | if ( item->getInt32("android.media.mediacodec.maxheight", &maxHeight)) { |
| 288 | metrics_proto.set_max_height(maxHeight); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 289 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 290 | AStatsEvent_writeInt32(event, maxHeight); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 291 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 292 | int32_t errorCode = -1; |
| 293 | if ( item->getInt32("android.media.mediacodec.errcode", &errorCode)) { |
| 294 | metrics_proto.set_error_code(errorCode); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 295 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 296 | AStatsEvent_writeInt32(event, errorCode); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 297 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 298 | std::string errorState; |
| 299 | if ( item->getString("android.media.mediacodec.errstate", &errorState)) { |
| 300 | metrics_proto.set_error_state(errorState); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 301 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 302 | AStatsEvent_writeString(event, errorState.c_str()); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 303 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 304 | int64_t latencyMax = -1; |
| 305 | if (item->getInt64("android.media.mediacodec.latency.max", &latencyMax)) { |
| 306 | metrics_proto.set_latency_max(latencyMax); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 307 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 308 | AStatsEvent_writeInt64(event, latencyMax); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 309 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 310 | int64_t latencyMin = -1; |
| 311 | if (item->getInt64("android.media.mediacodec.latency.min", &latencyMin)) { |
| 312 | metrics_proto.set_latency_min(latencyMin); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 313 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 314 | AStatsEvent_writeInt64(event, latencyMin); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 315 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 316 | int64_t latencyAvg = -1; |
| 317 | if (item->getInt64("android.media.mediacodec.latency.avg", &latencyAvg)) { |
| 318 | metrics_proto.set_latency_avg(latencyAvg); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 319 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 320 | AStatsEvent_writeInt64(event, latencyAvg); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 321 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 322 | int64_t latencyCount = -1; |
| 323 | if (item->getInt64("android.media.mediacodec.latency.n", &latencyCount)) { |
| 324 | metrics_proto.set_latency_count(latencyCount); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 325 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 326 | AStatsEvent_writeInt64(event, latencyCount); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 327 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 328 | int64_t latencyUnknown = -1; |
| 329 | if (item->getInt64("android.media.mediacodec.latency.unknown", &latencyUnknown)) { |
| 330 | metrics_proto.set_latency_unknown(latencyUnknown); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 331 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 332 | AStatsEvent_writeInt64(event, latencyUnknown); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 333 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 334 | int32_t queueSecureInputBufferError = -1; |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 335 | if (item->getInt32("android.media.mediacodec.queueSecureInputBufferError", |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 336 | &queueSecureInputBufferError)) { |
| 337 | metrics_proto.set_queue_secure_input_buffer_error(queueSecureInputBufferError); |
Edwin Wong | 4f10539 | 2020-02-12 14:55:00 -0800 | [diff] [blame] | 338 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 339 | AStatsEvent_writeInt32(event, queueSecureInputBufferError); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 340 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 341 | int32_t queueInputBufferError = -1; |
| 342 | if (item->getInt32("android.media.mediacodec.queueInputBufferError", &queueInputBufferError)) { |
| 343 | metrics_proto.set_queue_input_buffer_error(queueInputBufferError); |
Edwin Wong | 4f10539 | 2020-02-12 14:55:00 -0800 | [diff] [blame] | 344 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 345 | AStatsEvent_writeInt32(event, queueInputBufferError); |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 346 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 347 | std::string bitrateMode; |
| 348 | if (item->getString("android.media.mediacodec.bitrate_mode", &bitrateMode)) { |
| 349 | metrics_proto.set_bitrate_mode(bitrateMode); |
Ray Essick | a21a3d3 | 2020-05-10 21:08:10 -0700 | [diff] [blame] | 350 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 351 | AStatsEvent_writeString(event, bitrateMode.c_str()); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 352 | |
Ray Essick | a21a3d3 | 2020-05-10 21:08:10 -0700 | [diff] [blame] | 353 | int32_t bitrate = -1; |
| 354 | if (item->getInt32("android.media.mediacodec.bitrate", &bitrate)) { |
| 355 | metrics_proto.set_bitrate(bitrate); |
| 356 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 357 | AStatsEvent_writeInt32(event, bitrate); |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 358 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 359 | int64_t lifetimeMillis = -1; |
| 360 | if (item->getInt64("android.media.mediacodec.lifetimeMs", &lifetimeMillis)) { |
| 361 | lifetimeMillis = mediametrics::bucket_time_minutes(lifetimeMillis); |
| 362 | metrics_proto.set_lifetime_millis(lifetimeMillis); |
Ray Essick | a21a3d3 | 2020-05-10 21:08:10 -0700 | [diff] [blame] | 363 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 364 | AStatsEvent_writeInt64(event, lifetimeMillis); |
Ray Essick | a21a3d3 | 2020-05-10 21:08:10 -0700 | [diff] [blame] | 365 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 366 | int64_t playbackDurationSec = -1; |
| 367 | item->getInt64("android.media.mediacodec.playback-duration-sec", &playbackDurationSec); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 368 | // DO NOT record playback-duration in the metrics_proto - it should only |
| 369 | // exist in the flattened atom |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 370 | AStatsEvent_writeInt64(event, playbackDurationSec); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 371 | |
| 372 | std::string sessionId; |
| 373 | if (item->getString("android.media.mediacodec.log-session-id", &sessionId)) { |
Andy Hung | c9b6f8b | 2021-07-08 10:17:55 -0700 | [diff] [blame] | 374 | sessionId = mediametrics::ValidateId::get()->validateId(sessionId); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 375 | metrics_proto.set_log_session_id(sessionId); |
| 376 | } |
Ray Essick | e5d245f | 2022-04-06 11:13:34 -0700 | [diff] [blame] | 377 | AStatsEvent_writeString(event, sessionId.c_str()); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 378 | |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 379 | int32_t channelCount = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 380 | if (item->getInt32("android.media.mediacodec.channelCount", &channelCount)) { |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 381 | metrics_proto.set_channel_count(channelCount); |
| 382 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 383 | AStatsEvent_writeInt32(event, channelCount); |
Ray Essick | 8791331 | 2021-03-02 10:45:54 -0800 | [diff] [blame] | 384 | |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 385 | int32_t sampleRate = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 386 | if (item->getInt32("android.media.mediacodec.sampleRate", &sampleRate)) { |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 387 | metrics_proto.set_sample_rate(sampleRate); |
| 388 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 389 | AStatsEvent_writeInt32(event, sampleRate); |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 390 | |
Ray Essick | 8791331 | 2021-03-02 10:45:54 -0800 | [diff] [blame] | 391 | // TODO PWG may want these fuzzed up a bit to obscure some precision |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 392 | int64_t bytes = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 393 | if (item->getInt64("android.media.mediacodec.vencode.bytes", &bytes)) { |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 394 | metrics_proto.set_video_encode_bytes(bytes); |
| 395 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 396 | AStatsEvent_writeInt64(event, bytes); |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 397 | |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 398 | int64_t frames = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 399 | if (item->getInt64("android.media.mediacodec.vencode.frames", &frames)) { |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 400 | metrics_proto.set_video_encode_frames(frames); |
| 401 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 402 | AStatsEvent_writeInt64(event, frames); |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 403 | |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 404 | int64_t inputBytes = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 405 | if (item->getInt64("android.media.mediacodec.video.input.bytes", &inputBytes)) { |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 406 | metrics_proto.set_video_input_bytes(inputBytes); |
| 407 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 408 | AStatsEvent_writeInt64(event, inputBytes); |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 409 | |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 410 | int64_t inputFrames = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 411 | if (item->getInt64("android.media.mediacodec.video.input.frames", &inputFrames)) { |
Dichen Zhang | 0de0575 | 2021-04-21 19:47:07 -0700 | [diff] [blame] | 412 | metrics_proto.set_video_input_frames(inputFrames); |
| 413 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 414 | AStatsEvent_writeInt64(event, inputFrames); |
Ray Essick | 8791331 | 2021-03-02 10:45:54 -0800 | [diff] [blame] | 415 | |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 416 | int64_t durationUs = -1; |
| 417 | if (item->getInt64("android.media.mediacodec.vencode.durationUs", &durationUs)) { |
| 418 | metrics_proto.set_video_encode_duration_us(durationUs); |
| 419 | } |
| 420 | AStatsEvent_writeInt64(event, durationUs); |
| 421 | |
| 422 | int32_t colorFormat = -1; |
| 423 | if (item->getInt32("android.media.mediacodec.color-format", &colorFormat)) { |
| 424 | metrics_proto.set_color_format(colorFormat); |
| 425 | } |
| 426 | AStatsEvent_writeInt32(event, colorFormat); |
| 427 | |
| 428 | double frameRate = -1.0; |
| 429 | if (item->getDouble("android.media.mediacodec.frame-rate", &frameRate)) { |
| 430 | metrics_proto.set_frame_rate(frameRate); |
| 431 | } |
| 432 | AStatsEvent_writeFloat(event, (float) frameRate); |
| 433 | |
| 434 | double captureRate = -1.0; |
| 435 | if (item->getDouble("android.media.mediacodec.capture-rate", &captureRate)) { |
| 436 | metrics_proto.set_capture_rate(captureRate); |
| 437 | } |
| 438 | AStatsEvent_writeFloat(event, (float) captureRate); |
| 439 | |
| 440 | double operatingRate = -1.0; |
| 441 | if (item->getDouble("android.media.mediacodec.operating-rate", &operatingRate)) { |
| 442 | metrics_proto.set_operating_rate(operatingRate); |
| 443 | } |
| 444 | AStatsEvent_writeFloat(event, (float) operatingRate); |
| 445 | |
| 446 | int32_t priority = -1; |
| 447 | if (item->getInt32("android.media.mediacodec.priority", &priority)) { |
| 448 | metrics_proto.set_priority(priority); |
| 449 | } |
| 450 | AStatsEvent_writeInt32(event, priority); |
| 451 | |
| 452 | int32_t qpIMin = -1; |
| 453 | if (item->getInt32("android.media.mediacodec.video-qp-i-min", &qpIMin)) { |
| 454 | metrics_proto.set_video_qp_i_min(qpIMin); |
| 455 | } |
| 456 | AStatsEvent_writeInt32(event, qpIMin); |
| 457 | |
| 458 | int32_t qpIMax = -1; |
| 459 | if (item->getInt32("android.media.mediacodec.video-qp-i-max", &qpIMax)) { |
| 460 | metrics_proto.set_video_qp_i_max(qpIMax); |
| 461 | } |
| 462 | AStatsEvent_writeInt32(event, qpIMax); |
| 463 | |
| 464 | int32_t qpPMin = -1; |
| 465 | if (item->getInt32("android.media.mediacodec.video-qp-p-min", &qpPMin)) { |
| 466 | metrics_proto.set_video_qp_p_min(qpPMin); |
| 467 | } |
| 468 | AStatsEvent_writeInt32(event, qpPMin); |
| 469 | |
| 470 | int32_t qpPMax = -1; |
| 471 | if (item->getInt32("android.media.mediacodec.video-qp-p-max", &qpPMax)) { |
| 472 | metrics_proto.set_video_qp_p_max(qpPMax); |
| 473 | } |
| 474 | AStatsEvent_writeInt32(event, qpPMax); |
| 475 | |
| 476 | int32_t qpBMin = -1; |
| 477 | if (item->getInt32("android.media.mediacodec.video-qp-b-min", &qpBMin)) { |
| 478 | metrics_proto.set_video_qp_b_min(qpBMin); |
| 479 | } |
| 480 | AStatsEvent_writeInt32(event, qpBMin); |
| 481 | |
| 482 | int32_t qpBMax = -1; |
| 483 | if (item->getInt32("android.media.mediacodec.video-qp-b-max", &qpBMax)) { |
| 484 | metrics_proto.set_video_qp_b_max(qpBMax); |
| 485 | } |
| 486 | AStatsEvent_writeInt32(event, qpBMax); |
| 487 | |
Dichen Zhang | e5bad78 | 2021-04-28 12:11:35 -0700 | [diff] [blame] | 488 | int32_t originalBitrate = -1; |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 489 | if (item->getInt32("android.media.mediacodec.original.bitrate", &originalBitrate)) { |
Dichen Zhang | e5bad78 | 2021-04-28 12:11:35 -0700 | [diff] [blame] | 490 | metrics_proto.set_original_bitrate(originalBitrate); |
| 491 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 492 | AStatsEvent_writeInt32(event, originalBitrate); |
Dichen Zhang | e5bad78 | 2021-04-28 12:11:35 -0700 | [diff] [blame] | 493 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 494 | int32_t shapingEnhanced = -1; |
| 495 | if ( item->getInt32("android.media.mediacodec.shaped", &shapingEnhanced)) { |
| 496 | metrics_proto.set_shaping_enhanced(shapingEnhanced); |
| 497 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 498 | AStatsEvent_writeInt32(event, shapingEnhanced); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 499 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 500 | int32_t qpIMinOri = -1; |
| 501 | if ( item->getInt32("android.media.mediacodec.original-video-qp-i-min", &qpIMinOri)) { |
| 502 | metrics_proto.set_original_video_qp_i_min(qpIMinOri); |
| 503 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 504 | AStatsEvent_writeInt32(event, qpIMinOri); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 505 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 506 | int32_t qpIMaxOri = -1; |
| 507 | if ( item->getInt32("android.media.mediacodec.original-video-qp-i-max", &qpIMaxOri)) { |
| 508 | metrics_proto.set_original_video_qp_i_max(qpIMaxOri); |
| 509 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 510 | AStatsEvent_writeInt32(event, qpIMaxOri); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 511 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 512 | int32_t qpPMinOri = -1; |
| 513 | if ( item->getInt32("android.media.mediacodec.original-video-qp-p-min", &qpPMinOri)) { |
| 514 | metrics_proto.set_original_video_qp_p_min(qpPMinOri); |
| 515 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 516 | AStatsEvent_writeInt32(event, qpPMinOri); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 517 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 518 | int32_t qpPMaxOri = -1; |
| 519 | if ( item->getInt32("android.media.mediacodec.original-video-qp-p-max", &qpPMaxOri)) { |
| 520 | metrics_proto.set_original_video_qp_p_max(qpPMaxOri); |
| 521 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 522 | AStatsEvent_writeInt32(event, qpPMaxOri); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 523 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 524 | int32_t qpBMinOri = -1; |
| 525 | if ( item->getInt32("android.media.mediacodec.original-video-qp-b-min", &qpBMinOri)) { |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 526 | metrics_proto.set_original_video_qp_b_min(qpBMinOri); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 527 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 528 | AStatsEvent_writeInt32(event, qpBMinOri); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 529 | |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 530 | int32_t qpBMaxOri = -1; |
| 531 | if ( item->getInt32("android.media.mediacodec.original-video-qp-b-max", &qpBMaxOri)) { |
| 532 | metrics_proto.set_original_video_qp_b_max(qpBMaxOri); |
| 533 | } |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 534 | AStatsEvent_writeInt32(event, qpBMaxOri); |
| 535 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 536 | int32_t configColorStandard = -1; |
| 537 | if (item->getInt32("android.media.mediacodec.config-color-standard", &configColorStandard)) { |
| 538 | metrics_proto.set_config_color_standard(configColorStandard); |
| 539 | } |
| 540 | AStatsEvent_writeInt32(event, configColorStandard); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 541 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 542 | int32_t configColorRange = -1; |
| 543 | if (item->getInt32("android.media.mediacodec.config-color-range", &configColorRange)) { |
| 544 | metrics_proto.set_config_color_range(configColorRange); |
| 545 | } |
| 546 | AStatsEvent_writeInt32(event, configColorRange); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 547 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 548 | int32_t configColorTransfer = -1; |
| 549 | if (item->getInt32("android.media.mediacodec.config-color-transfer", &configColorTransfer)) { |
| 550 | metrics_proto.set_config_color_transfer(configColorTransfer); |
| 551 | } |
| 552 | AStatsEvent_writeInt32(event, configColorTransfer); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 553 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 554 | int32_t parsedColorStandard = -1; |
| 555 | if (item->getInt32("android.media.mediacodec.parsed-color-standard", &parsedColorStandard)) { |
| 556 | metrics_proto.set_parsed_color_standard(parsedColorStandard); |
| 557 | } |
| 558 | AStatsEvent_writeInt32(event, parsedColorStandard); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 559 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 560 | int32_t parsedColorRange = -1; |
| 561 | if (item->getInt32("android.media.mediacodec.parsed-color-range", &parsedColorRange)) { |
| 562 | metrics_proto.set_parsed_color_range(parsedColorRange); |
| 563 | } |
| 564 | AStatsEvent_writeInt32(event, parsedColorRange); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 565 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 566 | int32_t parsedColorTransfer = -1; |
| 567 | if (item->getInt32("android.media.mediacodec.parsed-color-transfer", &parsedColorTransfer)) { |
| 568 | metrics_proto.set_parsed_color_transfer(parsedColorTransfer); |
| 569 | } |
| 570 | AStatsEvent_writeInt32(event, parsedColorTransfer); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 571 | |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 572 | int32_t hdrStaticInfo = -1; |
| 573 | if (item->getInt32("android.media.mediacodec.hdr-static-info", &hdrStaticInfo)) { |
| 574 | metrics_proto.set_hdr_static_info(hdrStaticInfo); |
| 575 | } |
| 576 | AStatsEvent_writeInt32(event, hdrStaticInfo); |
| 577 | |
| 578 | int32_t hdr10PlusInfo = -1; |
| 579 | if (item->getInt32("android.media.mediacodec.hdr10-plus-info", &hdr10PlusInfo)) { |
| 580 | metrics_proto.set_hdr10_plus_info(hdr10PlusInfo); |
| 581 | } |
| 582 | AStatsEvent_writeInt32(event, hdr10PlusInfo); |
| 583 | |
Songyue Han | 6dc3210 | 2023-01-04 21:42:52 +0000 | [diff] [blame] | 584 | int32_t hdrFormat = -1; |
Songyue Han | 4c1e537 | 2022-04-13 21:11:23 +0000 | [diff] [blame] | 585 | if (item->getInt32("android.media.mediacodec.hdr-format", &hdrFormat)) { |
| 586 | metrics_proto.set_hdr_format(hdrFormat); |
| 587 | } |
| 588 | AStatsEvent_writeInt32(event, hdrFormat); |
Songyue Han | 3be67f2 | 2022-01-20 22:04:10 +0000 | [diff] [blame] | 589 | |
Girish | 4e531c8 | 2023-02-17 00:36:29 +0000 | [diff] [blame] | 590 | int64_t codecId = 0; |
| 591 | if (item->getInt64("android.media.mediacodec.id", &codecId)) { |
| 592 | metrics_proto.set_codec_id(codecId); |
| 593 | } |
| 594 | AStatsEvent_writeInt64(event, codecId); |
| 595 | |
Songyue Han | 6dc3210 | 2023-01-04 21:42:52 +0000 | [diff] [blame] | 596 | int32_t arrayMode = -1; |
| 597 | if (item->getInt32("android.media.mediacodec.array-mode", &arrayMode)) { |
| 598 | metrics_proto.set_array_mode(arrayMode); |
| 599 | } |
| 600 | AStatsEvent_writeInt32(event, arrayMode); |
| 601 | |
| 602 | int32_t operationMode = -1; |
| 603 | if (item->getInt32("android.media.mediacodec.operation-mode", &operationMode)) { |
| 604 | metrics_proto.set_operation_mode(operationMode); |
| 605 | } |
| 606 | AStatsEvent_writeInt32(event, operationMode); |
| 607 | |
| 608 | int32_t outputSurface = -1; |
| 609 | if (item->getInt32("android.media.mediacodec.output-surface", &outputSurface)) { |
| 610 | metrics_proto.set_output_surface(outputSurface); |
| 611 | } |
| 612 | AStatsEvent_writeInt32(event, outputSurface); |
| 613 | |
| 614 | int32_t appMaxInputSize = -1; |
| 615 | if (item->getInt32("android.media.mediacodec.app-max-input-size", &appMaxInputSize)) { |
| 616 | metrics_proto.set_app_max_input_size(appMaxInputSize); |
| 617 | } |
| 618 | AStatsEvent_writeInt32(event, appMaxInputSize); |
| 619 | |
| 620 | int32_t usedMaxInputSize = -1; |
| 621 | if (item->getInt32("android.media.mediacodec.used-max-input-size", &usedMaxInputSize)) { |
| 622 | metrics_proto.set_used_max_input_size(usedMaxInputSize); |
| 623 | } |
| 624 | AStatsEvent_writeInt32(event, usedMaxInputSize); |
| 625 | |
| 626 | int32_t codecMaxInputSize = -1; |
| 627 | if (item->getInt32("android.media.mediacodec.codec-max-input-size", &codecMaxInputSize)) { |
| 628 | metrics_proto.set_codec_max_input_size(codecMaxInputSize); |
| 629 | } |
| 630 | AStatsEvent_writeInt32(event, codecMaxInputSize); |
| 631 | |
| 632 | int32_t flushCount = -1; |
| 633 | if (item->getInt32("android.media.mediacodec.flush-count", &flushCount)) { |
| 634 | metrics_proto.set_flush_count(flushCount); |
| 635 | } |
| 636 | AStatsEvent_writeInt32(event, flushCount); |
| 637 | |
| 638 | int32_t setSurfaceCount = -1; |
| 639 | if (item->getInt32("android.media.mediacodec.set-surface-count", &setSurfaceCount)) { |
| 640 | metrics_proto.set_set_surface_count(setSurfaceCount); |
| 641 | } |
| 642 | AStatsEvent_writeInt32(event, setSurfaceCount); |
| 643 | |
| 644 | int32_t resolutionChangeCount = -1; |
| 645 | if (item->getInt32("android.media.mediacodec.resolution-change-count", |
| 646 | &resolutionChangeCount)) { |
| 647 | metrics_proto.set_resolution_change_count(resolutionChangeCount); |
| 648 | } |
| 649 | AStatsEvent_writeInt32(event, resolutionChangeCount); |
| 650 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 651 | int64_t firstRenderTimeUs = -1; |
| 652 | item->getInt64("android.media.mediacodec.first-render-time-us", &firstRenderTimeUs); |
| 653 | int64_t framesReleased = -1; |
| 654 | item->getInt64("android.media.mediacodec.frames-released", &framesReleased); |
| 655 | int64_t framesRendered = -1; |
| 656 | item->getInt64("android.media.mediacodec.frames-rendered", &framesRendered); |
| 657 | int64_t framesDropped = -1; |
| 658 | item->getInt64("android.media.mediacodec.frames-dropped", &framesDropped); |
| 659 | int64_t framesSkipped = -1; |
| 660 | item->getInt64("android.media.mediacodec.frames-skipped", &framesSkipped); |
| 661 | double framerateContent = -1; |
| 662 | item->getDouble("android.media.mediacodec.framerate-content", &framerateContent); |
| 663 | double framerateActual = -1; |
| 664 | item->getDouble("android.media.mediacodec.framerate-actual", &framerateActual); |
| 665 | int64_t freezeScore = -1; |
| 666 | item->getInt64("android.media.mediacodec.freeze-score", &freezeScore); |
| 667 | double freezeRate = -1; |
| 668 | item->getDouble("android.media.mediacodec.freeze-rate", &freezeRate); |
| 669 | std::string freezeScoreHistogramStr; |
| 670 | item->getString("android.media.mediacodec.freeze-score-histogram", &freezeScoreHistogramStr); |
| 671 | std::string freezeScoreHistogramBucketsStr; |
| 672 | item->getString("android.media.mediacodec.freeze-score-histogram-buckets", |
| 673 | &freezeScoreHistogramBucketsStr); |
| 674 | std::string freezeDurationMsHistogramStr; |
| 675 | item->getString("android.media.mediacodec.freeze-duration-ms-histogram", |
| 676 | &freezeDurationMsHistogramStr); |
| 677 | std::string freezeDurationMsHistogramBucketsStr; |
| 678 | item->getString("android.media.mediacodec.freeze-duration-ms-histogram-buckets", |
| 679 | &freezeDurationMsHistogramBucketsStr); |
| 680 | std::string freezeDistanceMsHistogramStr; |
| 681 | item->getString("android.media.mediacodec.freeze-distance-ms-histogram", |
| 682 | &freezeDistanceMsHistogramStr); |
| 683 | std::string freezeDistanceMsHistogramBucketsStr; |
| 684 | item->getString("android.media.mediacodec.freeze-distance-ms-histogram-buckets", |
| 685 | &freezeDistanceMsHistogramBucketsStr); |
| 686 | int64_t judderScore = -1; |
| 687 | item->getInt64("android.media.mediacodec.judder-score", &judderScore); |
| 688 | double judderRate = -1; |
| 689 | item->getDouble("android.media.mediacodec.judder-rate", &judderRate); |
| 690 | std::string judderScoreHistogramStr; |
| 691 | item->getString("android.media.mediacodec.judder-score-histogram", &judderScoreHistogramStr); |
| 692 | std::string judderScoreHistogramBucketsStr; |
| 693 | item->getString("android.media.mediacodec.judder-score-histogram-buckets", |
| 694 | &judderScoreHistogramBucketsStr); |
| 695 | |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 696 | int err = AStatsEvent_write(event); |
| 697 | if (err < 0) { |
| 698 | ALOGE("Failed to write codec metrics to statsd (%d)", err); |
| 699 | } |
| 700 | AStatsEvent_release(event); |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 701 | |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 702 | if (framesRendered > 0) { |
| 703 | int32_t statsUid = item->getUid(); |
| 704 | int64_t statsCodecId = codecId; |
| 705 | char const *statsLogSessionId = sessionId.c_str(); |
| 706 | int32_t statsIsHardware = isHardware; |
| 707 | int32_t statsIsSecure = isSecure; |
| 708 | int32_t statsIsTunneled = isTunneled; |
| 709 | int32_t statsCodec = getMetricsCodecEnum(mime, codec); |
| 710 | int32_t statsResolution = getMetricsResolutionEnum(width, height); |
| 711 | int32_t statsBitrate = BITRATE_UNKNOWN; |
| 712 | int32_t statsContentFramerate = getMetricsFramerateEnum(framerateContent); |
| 713 | int32_t statsActualFramerate = getMetricsFramerateEnum(framerateActual); |
| 714 | int32_t statsHdrFormat = getMetricsHdrFormatEnum(mime, codec, configColorTransfer, |
| 715 | parsedColorTransfer, hdrStaticInfo, |
| 716 | hdr10PlusInfo); |
| 717 | int64_t statsFirstRenderTimeUs = firstRenderTimeUs; |
| 718 | int64_t statsPlaybackDurationSeconds = playbackDurationSec; |
| 719 | int64_t statsFramesTotal = framesReleased + framesSkipped; |
| 720 | int64_t statsFramesReleased = framesReleased; |
| 721 | int64_t statsFramesRendered = framesRendered; |
| 722 | int64_t statsFramesDropped = framesDropped; |
| 723 | int64_t statsFramesSkipped = framesSkipped; |
| 724 | float statsFrameDropRate = float(double(framesDropped) / statsFramesTotal); |
| 725 | float statsFrameSkipRate = float(double(framesSkipped) / statsFramesTotal); |
| 726 | float statsFrameSkipDropRate = float(double(framesSkipped + framesDropped) / |
| 727 | statsFramesTotal); |
| 728 | int64_t statsFreezeScore = freezeScore; |
| 729 | float statsFreezeRate = freezeRate; |
| 730 | std::vector<int32_t> statsFreezeDurationMsHistogram; |
| 731 | parseVector(freezeDurationMsHistogramStr, &statsFreezeDurationMsHistogram); |
| 732 | std::vector<int32_t> statsFreezeDurationMsHistogramBuckets; |
| 733 | parseVector(freezeDurationMsHistogramBucketsStr, &statsFreezeDurationMsHistogramBuckets); |
| 734 | std::vector<int32_t> statsFreezeDistanceMsHistogram; |
| 735 | parseVector(freezeDistanceMsHistogramStr, &statsFreezeDistanceMsHistogram); |
| 736 | std::vector<int32_t> statsFreezeDistanceMsHistogramBuckets; |
| 737 | parseVector(freezeDistanceMsHistogramBucketsStr, &statsFreezeDistanceMsHistogramBuckets); |
| 738 | int64_t statsJudderScore = judderScore; |
| 739 | float statsJudderRate = judderRate; |
| 740 | std::vector<int32_t> statsJudderScoreHistogram; |
| 741 | parseVector(judderScoreHistogramStr, &statsJudderScoreHistogram); |
| 742 | std::vector<int32_t> statsJudderScoreHistogramBuckets; |
| 743 | parseVector(judderScoreHistogramBucketsStr, &statsJudderScoreHistogramBuckets); |
| 744 | int result = stats_write( |
| 745 | MEDIA_CODEC_RENDERED, |
| 746 | statsUid, |
| 747 | statsCodecId, |
| 748 | statsLogSessionId, |
| 749 | statsIsHardware, |
| 750 | statsIsSecure, |
| 751 | statsIsTunneled, |
| 752 | statsCodec, |
| 753 | statsResolution, |
| 754 | statsBitrate, |
| 755 | statsContentFramerate, |
| 756 | statsActualFramerate, |
| 757 | statsHdrFormat, |
| 758 | statsFirstRenderTimeUs, |
| 759 | statsPlaybackDurationSeconds, |
| 760 | statsFramesTotal, |
| 761 | statsFramesReleased, |
| 762 | statsFramesRendered, |
| 763 | statsFramesDropped, |
| 764 | statsFramesSkipped, |
| 765 | statsFrameDropRate, |
| 766 | statsFrameSkipRate, |
| 767 | statsFrameSkipDropRate, |
| 768 | statsFreezeScore, |
| 769 | statsFreezeRate, |
| 770 | statsFreezeDurationMsHistogram, |
| 771 | statsFreezeDurationMsHistogramBuckets, |
| 772 | statsFreezeDistanceMsHistogram, |
| 773 | statsFreezeDistanceMsHistogramBuckets, |
| 774 | statsJudderScore, |
| 775 | statsJudderRate, |
| 776 | statsJudderScoreHistogram, |
| 777 | statsJudderScoreHistogramBuckets); |
| 778 | ALOGE_IF(result < 0, "Failed to record MEDIA_CODEC_RENDERED atom (%d)", result); |
| 779 | } |
| 780 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 781 | std::string serialized; |
| 782 | if (!metrics_proto.SerializeToString(&serialized)) { |
| 783 | ALOGE("Failed to serialize codec metrics"); |
| 784 | return false; |
| 785 | } |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 786 | const stats::media_metrics::BytesField bf_serialized(serialized.c_str(), serialized.size()); |
Vova Sharaienko | f58455a | 2022-09-24 01:47:23 +0000 | [diff] [blame] | 787 | const int result = stats::media_metrics::stats_write(stats::media_metrics::MEDIAMETRICS_CODEC_REPORTED, |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 788 | timestampNanos, packageName.c_str(), packageVersionCode, |
| 789 | mediaApexVersion, |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 790 | bf_serialized); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 791 | |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 792 | std::stringstream log; |
| 793 | log << "result:" << result << " {" |
| 794 | << " mediametrics_codec_reported:" |
Vova Sharaienko | f58455a | 2022-09-24 01:47:23 +0000 | [diff] [blame] | 795 | << stats::media_metrics::MEDIAMETRICS_CODEC_REPORTED |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 796 | << " timestamp_nanos:" << timestampNanos |
| 797 | << " package_name:" << packageName |
| 798 | << " package_version_code:" << packageVersionCode |
| 799 | << " media_apex_version:" << mediaApexVersion |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 800 | << " codec:" << codec |
| 801 | << " mime:" << mime |
| 802 | << " mode:" << mode |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 803 | << " encoder:" << isEncoder |
| 804 | << " secure:" << isSecure |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 805 | << " width:" << width |
| 806 | << " height:" << height |
| 807 | << " rotation:" << rotation |
| 808 | << " crypto:" << crypto |
| 809 | << " profile:" << profile |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 810 | << " level:" << level |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 811 | << " max_width:" << maxWidth |
| 812 | << " max_height:" << maxHeight |
| 813 | << " error_code:" << errorCode |
| 814 | << " error_state:" << errorState |
| 815 | << " latency_max:" << latencyMax |
| 816 | << " latency_min:" << latencyMin |
| 817 | << " latency_avg:" << latencyAvg |
| 818 | << " latency_count:" << latencyCount |
| 819 | << " latency_unknown:" << latencyUnknown |
| 820 | << " queue_input_buffer_error:" << queueInputBufferError |
| 821 | << " queue_secure_input_buffer_error:" << queueSecureInputBufferError |
| 822 | << " bitrate_mode:" << bitrateMode |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 823 | << " bitrate:" << bitrate |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 824 | << " original_bitrate:" << originalBitrate |
Brian Lindahl | 590e385 | 2023-05-05 15:21:58 -0600 | [diff] [blame] | 825 | << " lifetime_millis:" << lifetimeMillis |
| 826 | << " playback_duration_seconds:" << playbackDurationSec |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 827 | << " log_session_id:" << sessionId |
| 828 | << " channel_count:" << channelCount |
| 829 | << " sample_rate:" << sampleRate |
| 830 | << " encode_bytes:" << bytes |
| 831 | << " encode_frames:" << frames |
| 832 | << " encode_duration_us:" << durationUs |
| 833 | << " color_format:" << colorFormat |
| 834 | << " frame_rate:" << frameRate |
| 835 | << " capture_rate:" << captureRate |
| 836 | << " operating_rate:" << operatingRate |
| 837 | << " priority:" << priority |
| 838 | << " shaping_enhanced:" << shapingEnhanced |
Dichen Zhang | 57be630 | 2021-05-18 18:20:31 -0700 | [diff] [blame] | 839 | << " qp_i_min:" << qpIMin |
| 840 | << " qp_i_max:" << qpIMax |
| 841 | << " qp_p_min:" << qpPMin |
| 842 | << " qp_p_max:" << qpPMax |
| 843 | << " qp_b_min:" << qpBMin |
| 844 | << " qp_b_max:" << qpBMax |
| 845 | << " original_qp_i_min:" << qpIMinOri |
| 846 | << " original_qp_i_max:" << qpIMaxOri |
| 847 | << " original_qp_p_min:" << qpPMinOri |
| 848 | << " original_qp_p_max:" << qpPMaxOri |
| 849 | << " original_qp_b_min:" << qpBMinOri |
| 850 | << " original_qp_b_max:" << qpBMaxOri |
Andy Hung | 5be90c8 | 2021-03-30 14:30:20 -0700 | [diff] [blame] | 851 | << " }"; |
Vova Sharaienko | f58455a | 2022-09-24 01:47:23 +0000 | [diff] [blame] | 852 | statsdLog->log(stats::media_metrics::MEDIAMETRICS_CODEC_REPORTED, log.str()); |
Brian Lindahl | c935ee2 | 2021-06-08 09:57:07 +0200 | [diff] [blame] | 853 | |
| 854 | |
Ray Essick | 6ce27e5 | 2019-02-15 10:58:05 -0800 | [diff] [blame] | 855 | return true; |
| 856 | } |
| 857 | |
Andy Hung | 3ab1b32 | 2020-05-18 10:47:31 -0700 | [diff] [blame] | 858 | } // namespace android |