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

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

Issue 2047003003: Rename MediaCodecBridge::Reset() to Flush() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missed a couple Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ndk_media_codec_bridge.h" 5 #include "media/base/android/ndk_media_codec_bridge.h"
6 6
7 #include <media/NdkMediaError.h> 7 #include <media/NdkMediaError.h>
8 #include <media/NdkMediaFormat.h> 8 #include <media/NdkMediaFormat.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 NOTIMPLEMENTED(); 47 NOTIMPLEMENTED();
48 return; 48 return;
49 } 49 }
50 50
51 if (direction == MEDIA_CODEC_DECODER) 51 if (direction == MEDIA_CODEC_DECODER)
52 media_codec_.reset(AMediaCodec_createDecoderByType(mime.c_str())); 52 media_codec_.reset(AMediaCodec_createDecoderByType(mime.c_str()));
53 else 53 else
54 media_codec_.reset(AMediaCodec_createEncoderByType(mime.c_str())); 54 media_codec_.reset(AMediaCodec_createEncoderByType(mime.c_str()));
55 } 55 }
56 56
57 MediaCodecStatus NdkMediaCodecBridge::Reset() {
58 media_status_t status = AMediaCodec_flush(media_codec_.get());
59 return TranslateMediaCodecStatus(status);
60 }
61
62 bool NdkMediaCodecBridge::Start() { 57 bool NdkMediaCodecBridge::Start() {
63 return AMEDIA_OK == AMediaCodec_start(media_codec_.get()); 58 return AMEDIA_OK == AMediaCodec_start(media_codec_.get());
64 } 59 }
65 60
66 void NdkMediaCodecBridge::Stop() { 61 void NdkMediaCodecBridge::Stop() {
67 AMediaCodec_stop(media_codec_.get()); 62 AMediaCodec_stop(media_codec_.get());
68 } 63 }
69 64
65 MediaCodecStatus NdkMediaCodecBridge::Flush() {
66 media_status_t status = AMediaCodec_flush(media_codec_.get());
67 return TranslateMediaCodecStatus(status);
68 }
69
70 MediaCodecStatus NdkMediaCodecBridge::GetOutputSize(gfx::Size* size) { 70 MediaCodecStatus NdkMediaCodecBridge::GetOutputSize(gfx::Size* size) {
71 AMediaFormat* format = AMediaCodec_getOutputFormat(media_codec_.get()); 71 AMediaFormat* format = AMediaCodec_getOutputFormat(media_codec_.get());
72 int left, right, bottom, top; 72 int left, right, bottom, top;
73 bool has_left = AMediaFormat_getInt32(format, kMediaFormatKeyCropLeft, &left); 73 bool has_left = AMediaFormat_getInt32(format, kMediaFormatKeyCropLeft, &left);
74 bool has_right = 74 bool has_right =
75 AMediaFormat_getInt32(format, kMediaFormatKeyCropRight, &right); 75 AMediaFormat_getInt32(format, kMediaFormatKeyCropRight, &right);
76 bool has_bottom = 76 bool has_bottom =
77 AMediaFormat_getInt32(format, kMediaFormatKeyCropBottom, &bottom); 77 AMediaFormat_getInt32(format, kMediaFormatKeyCropBottom, &bottom);
78 bool has_top = AMediaFormat_getInt32(format, kMediaFormatKeyCropTop, &top); 78 bool has_top = AMediaFormat_getInt32(format, kMediaFormatKeyCropTop, &top);
79 int width, height; 79 int width, height;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 const uint8_t** addr, 243 const uint8_t** addr,
244 size_t* capacity) { 244 size_t* capacity) {
245 const uint8_t* src_data = 245 const uint8_t* src_data =
246 AMediaCodec_getOutputBuffer(media_codec_.get(), index, capacity); 246 AMediaCodec_getOutputBuffer(media_codec_.get(), index, capacity);
247 *addr = src_data + offset; 247 *addr = src_data + offset;
248 *capacity -= offset; 248 *capacity -= offset;
249 return MEDIA_CODEC_OK; 249 return MEDIA_CODEC_OK;
250 } 250 }
251 251
252 } // namespace media 252 } // namespace media
OLDNEW
« no previous file with comments | « media/base/android/ndk_media_codec_bridge.h ('k') | media/base/android/sdk_media_codec_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698