| 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 void VideoCodecBridge::SetSurface(jobject surface) { |
| 656 JNIEnv* env = AttachCurrentThread(); |
| 657 Java_MediaCodecBridge_setSurface(env, media_codec(), surface); |
| 658 } |
| 659 |
| 655 void VideoCodecBridge::SetVideoBitrate(int bps, int frame_rate) { | 660 void VideoCodecBridge::SetVideoBitrate(int bps, int frame_rate) { |
| 656 JNIEnv* env = AttachCurrentThread(); | 661 JNIEnv* env = AttachCurrentThread(); |
| 657 Java_MediaCodecBridge_setVideoBitrate(env, media_codec(), bps, frame_rate); | 662 Java_MediaCodecBridge_setVideoBitrate(env, media_codec(), bps, frame_rate); |
| 658 } | 663 } |
| 659 | 664 |
| 660 void VideoCodecBridge::RequestKeyFrameSoon() { | 665 void VideoCodecBridge::RequestKeyFrameSoon() { |
| 661 JNIEnv* env = AttachCurrentThread(); | 666 JNIEnv* env = AttachCurrentThread(); |
| 662 Java_MediaCodecBridge_requestKeyFrameSoon(env, media_codec()); | 667 Java_MediaCodecBridge_requestKeyFrameSoon(env, media_codec()); |
| 663 } | 668 } |
| 664 | 669 |
| 665 bool VideoCodecBridge::IsAdaptivePlaybackSupported(int width, int height) { | 670 bool VideoCodecBridge::IsAdaptivePlaybackSupported(int width, int height) { |
| 666 if (adaptive_playback_supported_for_testing_ == 0) | 671 if (adaptive_playback_supported_for_testing_ == 0) |
| 667 return false; | 672 return false; |
| 668 else if (adaptive_playback_supported_for_testing_ > 0) | 673 else if (adaptive_playback_supported_for_testing_ > 0) |
| 669 return true; | 674 return true; |
| 670 JNIEnv* env = AttachCurrentThread(); | 675 JNIEnv* env = AttachCurrentThread(); |
| 671 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), | 676 return Java_MediaCodecBridge_isAdaptivePlaybackSupported(env, media_codec(), |
| 672 width, height); | 677 width, height); |
| 673 } | 678 } |
| 674 | 679 |
| 675 } // namespace media | 680 } // namespace media |
| OLD | NEW |