Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | ** |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 3 | ** Copyright 2015-2018, The Android Open Source Project |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 4 | ** |
| 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
| 8 | ** |
| 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | ** |
| 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
| 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | #define LOG_TAG "OutputConfiguration" |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 19 | //#define LOG_NDEBUG 0 |
| 20 | |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 21 | #include <utils/Log.h> |
| 22 | |
| 23 | #include <camera/camera2/OutputConfiguration.h> |
| 24 | #include <binder/Parcel.h> |
Mathias Agopian | 032845c | 2017-02-08 17:05:02 -0800 | [diff] [blame] | 25 | #include <gui/view/Surface.h> |
Brian Anderson | f675356 | 2016-10-11 14:51:05 -0700 | [diff] [blame] | 26 | #include <utils/String8.h> |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 27 | |
| 28 | namespace android { |
| 29 | |
| 30 | |
| 31 | const int OutputConfiguration::INVALID_ROTATION = -1; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 32 | const int OutputConfiguration::INVALID_SET_ID = -1; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 33 | |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 34 | const std::vector<sp<IGraphicBufferProducer>>& |
| 35 | OutputConfiguration::getGraphicBufferProducers() const { |
| 36 | return mGbps; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | int OutputConfiguration::getRotation() const { |
| 40 | return mRotation; |
| 41 | } |
| 42 | |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 43 | int OutputConfiguration::getSurfaceSetID() const { |
| 44 | return mSurfaceSetID; |
| 45 | } |
| 46 | |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 47 | int OutputConfiguration::getSurfaceType() const { |
| 48 | return mSurfaceType; |
| 49 | } |
| 50 | |
| 51 | int OutputConfiguration::getWidth() const { |
| 52 | return mWidth; |
| 53 | } |
| 54 | |
| 55 | int OutputConfiguration::getHeight() const { |
| 56 | return mHeight; |
| 57 | } |
| 58 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 59 | bool OutputConfiguration::isDeferred() const { |
| 60 | return mIsDeferred; |
| 61 | } |
| 62 | |
| 63 | bool OutputConfiguration::isShared() const { |
| 64 | return mIsShared; |
| 65 | } |
| 66 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 67 | String16 OutputConfiguration::getPhysicalCameraId() const { |
| 68 | return mPhysicalCameraId; |
| 69 | } |
| 70 | |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 71 | bool OutputConfiguration::isMultiResolution() const { |
| 72 | return mIsMultiResolution; |
| 73 | } |
| 74 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 75 | const std::vector<int32_t> &OutputConfiguration::getSensorPixelModesUsed() const { |
| 76 | return mSensorPixelModesUsed; |
| 77 | } |
| 78 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 79 | OutputConfiguration::OutputConfiguration() : |
| 80 | mRotation(INVALID_ROTATION), |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 81 | mSurfaceSetID(INVALID_SET_ID), |
| 82 | mSurfaceType(SURFACE_TYPE_UNKNOWN), |
| 83 | mWidth(0), |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 84 | mHeight(0), |
| 85 | mIsDeferred(false), |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 86 | mIsShared(false), |
| 87 | mIsMultiResolution(false) { |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 88 | } |
| 89 | |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 90 | OutputConfiguration::OutputConfiguration(const android::Parcel& parcel) : |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 91 | mRotation(INVALID_ROTATION), |
| 92 | mSurfaceSetID(INVALID_SET_ID) { |
| 93 | readFromParcel(&parcel); |
| 94 | } |
| 95 | |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 96 | status_t OutputConfiguration::readFromParcel(const android::Parcel* parcel) { |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 97 | status_t err = OK; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 98 | int rotation = 0; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 99 | |
| 100 | if (parcel == nullptr) return BAD_VALUE; |
| 101 | |
| 102 | if ((err = parcel->readInt32(&rotation)) != OK) { |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 103 | ALOGE("%s: Failed to read rotation from parcel", __FUNCTION__); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 104 | return err; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 107 | int setID = INVALID_SET_ID; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 108 | if ((err = parcel->readInt32(&setID)) != OK) { |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 109 | ALOGE("%s: Failed to read surface set ID from parcel", __FUNCTION__); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 110 | return err; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 111 | } |
| 112 | |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 113 | int surfaceType = SURFACE_TYPE_UNKNOWN; |
| 114 | if ((err = parcel->readInt32(&surfaceType)) != OK) { |
| 115 | ALOGE("%s: Failed to read surface type from parcel", __FUNCTION__); |
| 116 | return err; |
| 117 | } |
| 118 | |
| 119 | int width = 0; |
| 120 | if ((err = parcel->readInt32(&width)) != OK) { |
| 121 | ALOGE("%s: Failed to read surface width from parcel", __FUNCTION__); |
| 122 | return err; |
| 123 | } |
| 124 | |
| 125 | int height = 0; |
| 126 | if ((err = parcel->readInt32(&height)) != OK) { |
| 127 | ALOGE("%s: Failed to read surface height from parcel", __FUNCTION__); |
| 128 | return err; |
| 129 | } |
| 130 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 131 | int isDeferred = 0; |
| 132 | if ((err = parcel->readInt32(&isDeferred)) != OK) { |
| 133 | ALOGE("%s: Failed to read surface isDeferred flag from parcel", __FUNCTION__); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 134 | return err; |
| 135 | } |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 136 | |
| 137 | int isShared = 0; |
| 138 | if ((err = parcel->readInt32(&isShared)) != OK) { |
| 139 | ALOGE("%s: Failed to read surface isShared flag from parcel", __FUNCTION__); |
| 140 | return err; |
| 141 | } |
| 142 | |
| 143 | if (isDeferred && surfaceType != SURFACE_TYPE_SURFACE_VIEW && |
| 144 | surfaceType != SURFACE_TYPE_SURFACE_TEXTURE) { |
| 145 | ALOGE("%s: Invalid surface type for deferred configuration", __FUNCTION__); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 146 | return BAD_VALUE; |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 147 | } |
| 148 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 149 | std::vector<view::Surface> surfaceShims; |
| 150 | if ((err = parcel->readParcelableVector(&surfaceShims)) != OK) { |
| 151 | ALOGE("%s: Failed to read surface(s) from parcel", __FUNCTION__); |
| 152 | return err; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 155 | parcel->readString16(&mPhysicalCameraId); |
| 156 | |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 157 | int isMultiResolution = 0; |
| 158 | if ((err = parcel->readInt32(&isMultiResolution)) != OK) { |
| 159 | ALOGE("%s: Failed to read surface isMultiResolution flag from parcel", __FUNCTION__); |
| 160 | return err; |
| 161 | } |
| 162 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 163 | std::vector<int32_t> sensorPixelModesUsed; |
| 164 | if ((err = parcel->readParcelableVector(&sensorPixelModesUsed)) != OK) { |
| 165 | ALOGE("%s: Failed to read sensor pixel mode(s) from parcel", __FUNCTION__); |
| 166 | return err; |
| 167 | } |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 168 | mRotation = rotation; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 169 | mSurfaceSetID = setID; |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 170 | mSurfaceType = surfaceType; |
| 171 | mWidth = width; |
| 172 | mHeight = height; |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 173 | mIsDeferred = isDeferred != 0; |
| 174 | mIsShared = isShared != 0; |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 175 | mIsMultiResolution = isMultiResolution != 0; |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 176 | for (auto& surface : surfaceShims) { |
| 177 | ALOGV("%s: OutputConfiguration: %p, name %s", __FUNCTION__, |
| 178 | surface.graphicBufferProducer.get(), |
| 179 | String8(surface.name).string()); |
| 180 | mGbps.push_back(surface.graphicBufferProducer); |
| 181 | } |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 182 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 183 | mSensorPixelModesUsed = std::move(sensorPixelModesUsed); |
| 184 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 185 | ALOGV("%s: OutputConfiguration: rotation = %d, setId = %d, surfaceType = %d," |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 186 | " physicalCameraId = %s, isMultiResolution = %d", __FUNCTION__, mRotation, |
| 187 | mSurfaceSetID, mSurfaceType, String8(mPhysicalCameraId).string(), mIsMultiResolution); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 188 | |
| 189 | return err; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 190 | } |
| 191 | |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 192 | OutputConfiguration::OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation, |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 193 | const String16& physicalId, |
Emilian Peev | 40ead60 | 2017-09-26 15:46:36 +0100 | [diff] [blame] | 194 | int surfaceSetID, bool isShared) { |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 195 | mGbps.push_back(gbp); |
Ruben Brunk | 3450ba7 | 2015-06-16 11:00:37 -0700 | [diff] [blame] | 196 | mRotation = rotation; |
Zhijun He | 018107a | 2016-01-18 15:32:50 -0800 | [diff] [blame] | 197 | mSurfaceSetID = surfaceSetID; |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 198 | mIsDeferred = false; |
Emilian Peev | 40ead60 | 2017-09-26 15:46:36 +0100 | [diff] [blame] | 199 | mIsShared = isShared; |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 200 | mPhysicalCameraId = physicalId; |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 201 | mIsMultiResolution = false; |
Ruben Brunk | 3450ba7 | 2015-06-16 11:00:37 -0700 | [diff] [blame] | 202 | } |
| 203 | |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 204 | OutputConfiguration::OutputConfiguration( |
| 205 | const std::vector<sp<IGraphicBufferProducer>>& gbps, |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 206 | int rotation, const String16& physicalCameraId, int surfaceSetID, int surfaceType, |
| 207 | int width, int height, bool isShared) |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 208 | : mGbps(gbps), mRotation(rotation), mSurfaceSetID(surfaceSetID), mSurfaceType(surfaceType), |
Shuzhen Wang | 0ff9ae3 | 2018-12-05 18:06:12 -0800 | [diff] [blame] | 209 | mWidth(width), mHeight(height), mIsDeferred(false), mIsShared(isShared), |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 210 | mPhysicalCameraId(physicalCameraId), mIsMultiResolution(false) { } |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 211 | |
Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 212 | status_t OutputConfiguration::writeToParcel(android::Parcel* parcel) const { |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 213 | |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 214 | if (parcel == nullptr) return BAD_VALUE; |
| 215 | status_t err = OK; |
| 216 | |
| 217 | err = parcel->writeInt32(mRotation); |
| 218 | if (err != OK) return err; |
| 219 | |
| 220 | err = parcel->writeInt32(mSurfaceSetID); |
| 221 | if (err != OK) return err; |
| 222 | |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 223 | err = parcel->writeInt32(mSurfaceType); |
| 224 | if (err != OK) return err; |
| 225 | |
| 226 | err = parcel->writeInt32(mWidth); |
| 227 | if (err != OK) return err; |
| 228 | |
| 229 | err = parcel->writeInt32(mHeight); |
| 230 | if (err != OK) return err; |
| 231 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 232 | err = parcel->writeInt32(mIsDeferred ? 1 : 0); |
Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 233 | if (err != OK) return err; |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 234 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 235 | err = parcel->writeInt32(mIsShared ? 1 : 0); |
| 236 | if (err != OK) return err; |
| 237 | |
| 238 | std::vector<view::Surface> surfaceShims; |
| 239 | for (auto& gbp : mGbps) { |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 240 | view::Surface surfaceShim; |
| 241 | surfaceShim.name = String16("unknown_name"); // name of surface |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 242 | surfaceShim.graphicBufferProducer = gbp; |
| 243 | surfaceShims.push_back(surfaceShim); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 244 | } |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 245 | err = parcel->writeParcelableVector(surfaceShims); |
| 246 | if (err != OK) return err; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 247 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 248 | err = parcel->writeString16(mPhysicalCameraId); |
| 249 | if (err != OK) return err; |
| 250 | |
Shuzhen Wang | 83bff12 | 2020-11-20 15:51:39 -0800 | [diff] [blame] | 251 | err = parcel->writeInt32(mIsMultiResolution ? 1 : 0); |
| 252 | if (err != OK) return err; |
| 253 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 254 | err = parcel->writeParcelableVector(mSensorPixelModesUsed); |
| 255 | if (err != OK) return err; |
| 256 | |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 257 | return OK; |
| 258 | } |
| 259 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 260 | template <typename T> |
| 261 | static bool simpleVectorsEqual(T first, T second) { |
| 262 | if (first.size() != second.size()) { |
| 263 | return false; |
| 264 | } |
| 265 | |
| 266 | for (size_t i = 0; i < first.size(); i++) { |
| 267 | if (first[i] != second[i]) { |
| 268 | return false; |
| 269 | } |
| 270 | } |
| 271 | return true; |
| 272 | } |
| 273 | |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 274 | bool OutputConfiguration::gbpsEqual(const OutputConfiguration& other) const { |
| 275 | const std::vector<sp<IGraphicBufferProducer> >& otherGbps = |
| 276 | other.getGraphicBufferProducers(); |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 277 | return simpleVectorsEqual(otherGbps, mGbps); |
| 278 | } |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 279 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 280 | bool OutputConfiguration::sensorPixelModesUsedEqual(const OutputConfiguration& other) const { |
| 281 | const std::vector<int32_t>& othersensorPixelModesUsed = other.getSensorPixelModesUsed(); |
| 282 | return simpleVectorsEqual(othersensorPixelModesUsed, mSensorPixelModesUsed); |
| 283 | } |
| 284 | |
| 285 | bool OutputConfiguration::sensorPixelModesUsedLessThan(const OutputConfiguration& other) const { |
| 286 | const std::vector<int32_t>& spms = other.getSensorPixelModesUsed(); |
| 287 | |
| 288 | if (mSensorPixelModesUsed.size() != spms.size()) { |
| 289 | return mSensorPixelModesUsed.size() < spms.size(); |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 290 | } |
| 291 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 292 | for (size_t i = 0; i < spms.size(); i++) { |
| 293 | if (mSensorPixelModesUsed[i] != spms[i]) { |
| 294 | return mSensorPixelModesUsed[i] < spms[i]; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 295 | } |
| 296 | } |
| 297 | |
Jayant Chowdhary | 13f9b2f | 2020-12-02 22:46:15 -0800 | [diff] [blame] | 298 | return false; |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 299 | } |
| 300 | |
| 301 | bool OutputConfiguration::gbpsLessThan(const OutputConfiguration& other) const { |
| 302 | const std::vector<sp<IGraphicBufferProducer> >& otherGbps = |
| 303 | other.getGraphicBufferProducers(); |
| 304 | |
| 305 | if (mGbps.size() != otherGbps.size()) { |
| 306 | return mGbps.size() < otherGbps.size(); |
| 307 | } |
| 308 | |
| 309 | for (size_t i = 0; i < mGbps.size(); i++) { |
| 310 | if (mGbps[i] != otherGbps[i]) { |
| 311 | return mGbps[i] < otherGbps[i]; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | return false; |
| 316 | } |
Yin-Chia Yeh | b97babb | 2015-03-12 13:42:44 -0700 | [diff] [blame] | 317 | }; // namespace android |