| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/android/media_codec_bridge.h" | 5 #include "media/base/android/media_codec_bridge.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec, | 40 return QueueSecureInputBuffer(index, data, data_size, key_vec, iv_vec, |
| 41 subsamples.empty() ? nullptr : &subsamples[0], | 41 subsamples.empty() ? nullptr : &subsamples[0], |
| 42 subsamples.size(), presentation_time); | 42 subsamples.size(), presentation_time); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool MediaCodecBridge::FillInputBuffer(int index, | 45 bool MediaCodecBridge::FillInputBuffer(int index, |
| 46 const uint8_t* data, | 46 const uint8_t* data, |
| 47 size_t size) { | 47 size_t size) { |
| 48 uint8_t* dst = nullptr; | 48 uint8_t* dst = nullptr; |
| 49 size_t capacity = 0; | 49 size_t capacity = 0; |
| 50 GetInputBuffer(index, &dst, &capacity); | 50 if (GetInputBuffer(index, &dst, &capacity) != MEDIA_CODEC_OK) { |
| 51 LOG(ERROR) << "GetInputBuffer failed"; |
| 52 return false; |
| 53 } |
| 51 CHECK(dst); | 54 CHECK(dst); |
| 52 | 55 |
| 53 if (size > capacity) { | 56 if (size > capacity) { |
| 54 LOG(ERROR) << "Input buffer size " << size | 57 LOG(ERROR) << "Input buffer size " << size |
| 55 << " exceeds MediaCodec input buffer capacity: " << capacity; | 58 << " exceeds MediaCodec input buffer capacity: " << capacity; |
| 56 return false; | 59 return false; |
| 57 } | 60 } |
| 58 | 61 |
| 59 memcpy(dst, data, size); | 62 memcpy(dst, data, size); |
| 60 return true; | 63 return true; |
| 61 } | 64 } |
| 62 | 65 |
| 63 } // namespace media | 66 } // namespace media |
| OLD | NEW |