| 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/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 <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 return bridge->Start() ? bridge.release() : nullptr; | 645 return bridge->Start() ? bridge.release() : nullptr; |
| 646 } | 646 } |
| 647 | 647 |
| 648 VideoCodecBridge::VideoCodecBridge(const std::string& mime, | 648 VideoCodecBridge::VideoCodecBridge(const std::string& mime, |
| 649 bool is_secure, | 649 bool is_secure, |
| 650 MediaCodecDirection direction, | 650 MediaCodecDirection direction, |
| 651 bool require_software_codec) | 651 bool require_software_codec) |
| 652 : SdkMediaCodecBridge(mime, is_secure, direction, require_software_codec), | 652 : SdkMediaCodecBridge(mime, is_secure, direction, require_software_codec), |
| 653 adaptive_playback_supported_for_testing_(-1) {} | 653 adaptive_playback_supported_for_testing_(-1) {} |
| 654 | 654 |
| 655 bool VideoCodecBridge::SetSurface(jobject surface) { |
| 656 DCHECK_GE(base::android::BuildInfo::GetInstance()->sdk_int(), 23); |
| 657 JNIEnv* env = AttachCurrentThread(); |
| 658 return Java_MediaCodecBridge_setSurface(env, media_codec(), surface); |
| 659 } |
| 660 |
| 655 void VideoCodecBridge::SetVideoBitrate(int bps, int frame_rate) { | 661 void VideoCodecBridge::SetVideoBitrate(int bps, int frame_rate) { |
| 656 JNIEnv* env = AttachCurrentThread(); | 662 JNIEnv* env = AttachCurrentThread(); |
| 657 Java_MediaCodecBridge_setVideoBitrate(env, media_codec(), bps, frame_rate); | 663 Java_MediaCodecBridge_setVideoBitrate(env, media_codec(), bps, frame_rate); |
| 658 } | 664 } |
| 659 | 665 |
| 660 void VideoCodecBridge::RequestKeyFrameSoon() { | 666 void VideoCodecBridge::RequestKeyFrameSoon() { |
| 661 JNIEnv* env = AttachCurrentThread(); | 667 JNIEnv* env = AttachCurrentThread(); |
| 662 Java_MediaCodecBridge_requestKeyFrameSoon(env, media_codec()); | 668 Java_MediaCodecBridge_requestKeyFrameSoon(env, media_codec()); |
| 663 } | 669 } |
| 664 | 670 |
| 665 bool VideoCodecBridge::IsAdaptivePlaybackSupported(int width, int height) { | 671 bool VideoCodecBridge::IsAdaptivePlaybackSupported(int width, int height) { |
| 666 if (adaptive_playback_supported_for_testing_ == 0) | 672 if (adaptive_playback_supported_for_testing_ == 0) |
| 667 return false; | 673 return false; |
| 668 else if (adaptive_playback_supported_for_testing_ > 0) | 674 else if (adaptive_playback_supported_for_testing_ > 0) |
| 669 return true; | 675 return true; |
| 670 JNIEnv* env = AttachCurrentThread(); | 676 JNIEnv* env = AttachCurrentThread(); |
| 671 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 677 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 672 width, height); | 678 width, height); |
| 673 } | 679 } |
| 674 | 680 |
| 675 } // namespace media | 681 } // namespace media |
| OLD | NEW |