Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(582)

Side by Side Diff: media/base/android/media_codec_bridge.cc

Issue 1764813002: Catch CodecException in MediaCodecBridge and return MEDIA_CODEC_ERROR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dale's comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/ndk_media_codec_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « media/base/android/media_codec_bridge.h ('k') | media/base/android/ndk_media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698