Ray Essick | 2e9c63b | 2017-03-29 15:16:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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_TAG "MetricsSummarizerCodec" |
| 18 | #include <utils/Log.h> |
| 19 | |
Ray Essick | 002e413 | 2017-09-05 16:52:05 -0700 | [diff] [blame^] | 20 | #include <stdint.h> |
| 21 | #include <inttypes.h> |
Ray Essick | 2e9c63b | 2017-03-29 15:16:44 -0700 | [diff] [blame] | 22 | |
| 23 | #include <utils/threads.h> |
| 24 | #include <utils/Errors.h> |
| 25 | #include <utils/KeyedVector.h> |
| 26 | #include <utils/String8.h> |
| 27 | #include <utils/List.h> |
| 28 | |
| 29 | #include <media/IMediaAnalyticsService.h> |
| 30 | |
| 31 | #include "MetricsSummarizer.h" |
| 32 | #include "MetricsSummarizerCodec.h" |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | namespace android { |
| 38 | |
Ray Essick | 002e413 | 2017-09-05 16:52:05 -0700 | [diff] [blame^] | 39 | static const char *codec_ignorable[] = { |
| 40 | "android.media.mediacodec.bytesin", |
| 41 | 0 |
| 42 | }; |
| 43 | |
Ray Essick | 2e9c63b | 2017-03-29 15:16:44 -0700 | [diff] [blame] | 44 | MetricsSummarizerCodec::MetricsSummarizerCodec(const char *key) |
| 45 | : MetricsSummarizer(key) |
| 46 | { |
| 47 | ALOGV("MetricsSummarizerCodec::MetricsSummarizerCodec"); |
Ray Essick | 002e413 | 2017-09-05 16:52:05 -0700 | [diff] [blame^] | 48 | setIgnorables(codec_ignorable); |
| 49 | |
| 50 | } |
| 51 | |
| 52 | void MetricsSummarizerCodec::mergeRecord(MediaAnalyticsItem &summation, MediaAnalyticsItem &item) { |
| 53 | |
| 54 | ALOGV("MetricsSummarizerCodec::mergeRecord()"); |
| 55 | |
| 56 | int64_t bytesin = 0; |
| 57 | if (item.getInt64("android.media.mediacodec.bytesin", &bytesin)) { |
| 58 | ALOGV("found bytesin of %" PRId64, bytesin); |
| 59 | } |
| 60 | if (bytesin >= 0) { |
| 61 | minMaxVar64(summation,"android.media.mediacodec.bytesin", bytesin); |
| 62 | } |
Ray Essick | 2e9c63b | 2017-03-29 15:16:44 -0700 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | |
| 66 | } // namespace android |