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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 900 |
899 void MediaCodecVideoEncoder::OnDroppedFrame() { | 901 void MediaCodecVideoEncoder::OnDroppedFrame() { |
900 if (scale_) | 902 if (scale_) |
901 quality_scaler_.ReportDroppedFrame(); | 903 quality_scaler_.ReportDroppedFrame(); |
902 } | 904 } |
903 | 905 |
904 int MediaCodecVideoEncoder::GetTargetFramerate() { | 906 int MediaCodecVideoEncoder::GetTargetFramerate() { |
905 return scale_ ? quality_scaler_.GetTargetFramerate() : -1; | 907 return scale_ ? quality_scaler_.GetTargetFramerate() : -1; |
906 } | 908 } |
907 | 909 |
| 910 const char* MediaCodecVideoEncoder::ImplementationName() const { |
| 911 return "MediaCodec"; |
| 912 } |
| 913 |
908 MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() { | 914 MediaCodecVideoEncoderFactory::MediaCodecVideoEncoderFactory() { |
909 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 915 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
910 ScopedLocalRefFrame local_ref_frame(jni); | 916 ScopedLocalRefFrame local_ref_frame(jni); |
911 jclass j_encoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoEncoder"); | 917 jclass j_encoder_class = FindClass(jni, "org/webrtc/MediaCodecVideoEncoder"); |
912 supported_codecs_.clear(); | 918 supported_codecs_.clear(); |
913 | 919 |
914 bool is_vp8_hw_supported = jni->CallStaticBooleanMethod( | 920 bool is_vp8_hw_supported = jni->CallStaticBooleanMethod( |
915 j_encoder_class, | 921 j_encoder_class, |
916 GetStaticMethodID(jni, j_encoder_class, "isVp8HwSupported", "()Z")); | 922 GetStaticMethodID(jni, j_encoder_class, "isVp8HwSupported", "()Z")); |
917 CHECK_EXCEPTION(jni); | 923 CHECK_EXCEPTION(jni); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
956 } | 962 } |
957 | 963 |
958 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 964 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
959 webrtc::VideoEncoder* encoder) { | 965 webrtc::VideoEncoder* encoder) { |
960 ALOGD << "Destroy video encoder."; | 966 ALOGD << "Destroy video encoder."; |
961 delete encoder; | 967 delete encoder; |
962 } | 968 } |
963 | 969 |
964 } // namespace webrtc_jni | 970 } // namespace webrtc_jni |
965 | 971 |
OLD | NEW |