| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 int64_t /* rtt */) override; | 96 int64_t /* rtt */) override; |
| 97 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; | 97 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; |
| 98 | 98 |
| 99 // rtc::MessageHandler implementation. | 99 // rtc::MessageHandler implementation. |
| 100 void OnMessage(rtc::Message* msg) override; | 100 void OnMessage(rtc::Message* msg) override; |
| 101 | 101 |
| 102 void OnDroppedFrame() override; | 102 void OnDroppedFrame() override; |
| 103 | 103 |
| 104 int GetTargetFramerate() override; | 104 int GetTargetFramerate() override; |
| 105 | 105 |
| 106 const char* ImplementationName() const override; |
| 107 |
| 106 private: | 108 private: |
| 107 // CHECK-fail if not running on |codec_thread_|. | 109 // CHECK-fail if not running on |codec_thread_|. |
| 108 void CheckOnCodecThread(); | 110 void CheckOnCodecThread(); |
| 109 | 111 |
| 110 // Release() and InitEncode() in an attempt to restore the codec to an | 112 // Release() and InitEncode() in an attempt to restore the codec to an |
| 111 // operable state. Necessary after all manner of OMX-layer errors. | 113 // operable state. Necessary after all manner of OMX-layer errors. |
| 112 void ResetCodec(); | 114 void ResetCodec(); |
| 113 | 115 |
| 114 // Implementation of webrtc::VideoEncoder methods above, all running on the | 116 // Implementation of webrtc::VideoEncoder methods above, all running on the |
| 115 // codec thread exclusively. | 117 // codec thread exclusively. |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 | 899 |
| 898 void MediaCodecVideoEncoder::OnDroppedFrame() { | 900 void MediaCodecVideoEncoder::OnDroppedFrame() { |
| 899 if (scale_) | 901 if (scale_) |
| 900 quality_scaler_.ReportDroppedFrame(); | 902 quality_scaler_.ReportDroppedFrame(); |
| 901 } | 903 } |
| 902 | 904 |
| 903 int MediaCodecVideoEncoder::GetTargetFramerate() { | 905 int MediaCodecVideoEncoder::GetTargetFramerate() { |
| 904 return scale_ ? quality_scaler_.GetTargetFramerate() : -1; | 906 return scale_ ? quality_scaler_.GetTargetFramerate() : -1; |
| 905 } | 907 } |
| 906 | 908 |
| 909 const char* MediaCodecVideoEncoder::ImplementationName() const { |
| 910 return "MediaCodec"; |
| 911 } |
| 912 |
| 907 MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() { | 913 MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() { |
| 908 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 914 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 909 ScopedLocalRefFrame local_ref_frame(jni); | 915 ScopedLocalRefFrame local_ref_frame(jni); |
| 910 jclass j_encoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoEncoder"); | 916 jclass j_encoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoEncoder"); |
| 911 supported_codecs_.clear(); | 917 supported_codecs_.clear(); |
| 912 | 918 |
| 913 bool is_vp8_hw_supported = jni->CallStaticBooleanMethod( | 919 bool is_vp8_hw_supported = jni->CallStaticBooleanMethod( |
| 914 j_encoder_class, | 920 j_encoder_class, |
| 915 GetStaticMethodID(jni, j_encoder_class, "isVp8HwSupported", "()Z")); | 921 GetStaticMethodID(jni, j_encoder_class, "isVp8HwSupported", "()Z")); |
| 916 CHECK_EXCEPTION(jni); | 922 CHECK_EXCEPTION(jni); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 } | 961 } |
| 956 | 962 |
| 957 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 963 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
| 958 webrtc::VideoEncoder* encoder) { | 964 webrtc::VideoEncoder* encoder) { |
| 959 ALOGD << "Destroy video encoder."; | 965 ALOGD << "Destroy video encoder."; |
| 960 delete encoder; | 966 delete encoder; |
| 961 } | 967 } |
| 962 | 968 |
| 963 } // namespace webrtc_jni | 969 } // namespace webrtc_jni |
| 964 | 970 |
| OLD | NEW |