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

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

Issue 1918623002: Use the MediaCodec flush workaround in more cases (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 (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/sdk_media_codec_bridge.h" 5 #include "media/base/android/sdk_media_codec_bridge.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 size_t src_capacity = 0; 309 size_t src_capacity = 0;
310 MediaCodecStatus status = 310 MediaCodecStatus status =
311 GetOutputBufferAddress(index, offset, &src_data, &src_capacity); 311 GetOutputBufferAddress(index, offset, &src_data, &src_capacity);
312 if (status == MEDIA_CODEC_OK) { 312 if (status == MEDIA_CODEC_OK) {
313 CHECK_GE(src_capacity, num); 313 CHECK_GE(src_capacity, num);
314 memcpy(dst, src_data, num); 314 memcpy(dst, src_data, num);
315 } 315 }
316 return status; 316 return status;
317 } 317 }
318 318
319 std::string SdkMediaCodecBridge::GetName() {
320 if (base::android::BuildInfo::GetInstance()->sdk_int() < 18)
321 return "";
322
323 JNIEnv* env = AttachCurrentThread();
324 ScopedJavaLocalRef<jstring> j_name =
325 Java_MediaCodecBridge_getName(env, j_media_codec_.obj());
326 return ConvertJavaStringToUTF8(env, j_name.obj());
327 }
328
319 MediaCodecStatus SdkMediaCodecBridge::GetOutputBufferAddress(int index, 329 MediaCodecStatus SdkMediaCodecBridge::GetOutputBufferAddress(int index,
320 size_t offset, 330 size_t offset,
321 void** addr, 331 void** addr,
322 size_t* capacity) { 332 size_t* capacity) {
323 JNIEnv* env = AttachCurrentThread(); 333 JNIEnv* env = AttachCurrentThread();
324 ScopedJavaLocalRef<jobject> j_buffer( 334 ScopedJavaLocalRef<jobject> j_buffer(
325 Java_MediaCodecBridge_getOutputBuffer(env, j_media_codec_.obj(), index)); 335 Java_MediaCodecBridge_getOutputBuffer(env, j_media_codec_.obj(), index));
326 if (j_buffer.is_null()) 336 if (j_buffer.is_null())
327 return MEDIA_CODEC_ERROR; 337 return MEDIA_CODEC_ERROR;
328 const size_t total_capacity = env->GetDirectBufferCapacity(j_buffer.obj()); 338 const size_t total_capacity = env->GetDirectBufferCapacity(j_buffer.obj());
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 if (adaptive_playback_supported_for_testing_ == 0) 696 if (adaptive_playback_supported_for_testing_ == 0)
687 return false; 697 return false;
688 else if (adaptive_playback_supported_for_testing_ > 0) 698 else if (adaptive_playback_supported_for_testing_ > 0)
689 return true; 699 return true;
690 JNIEnv* env = AttachCurrentThread(); 700 JNIEnv* env = AttachCurrentThread();
691 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), 701 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(),
692 width, height); 702 width, height);
693 } 703 }
694 704
695 } // namespace media 705 } // namespace media
OLDNEW
« media/base/android/ndk_media_codec_bridge.cc ('K') | « media/base/android/sdk_media_codec_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698