| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 int32_t /* number_of_cores */, | 108 int32_t /* number_of_cores */, |
| 109 size_t /* max_payload_size */) override; | 109 size_t /* max_payload_size */) override; |
| 110 int32_t Encode(const webrtc::VideoFrame& input_image, | 110 int32_t Encode(const webrtc::VideoFrame& input_image, |
| 111 const webrtc::CodecSpecificInfo* /* codec_specific_info */, | 111 const webrtc::CodecSpecificInfo* /* codec_specific_info */, |
| 112 const std::vector<webrtc::FrameType>* frame_types) override; | 112 const std::vector<webrtc::FrameType>* frame_types) override; |
| 113 int32_t RegisterEncodeCompleteCallback( | 113 int32_t RegisterEncodeCompleteCallback( |
| 114 webrtc::EncodedImageCallback* callback) override; | 114 webrtc::EncodedImageCallback* callback) override; |
| 115 int32_t Release() override; | 115 int32_t Release() override; |
| 116 int32_t SetChannelParameters(uint32_t /* packet_loss */, | 116 int32_t SetChannelParameters(uint32_t /* packet_loss */, |
| 117 int64_t /* rtt */) override; | 117 int64_t /* rtt */) override; |
| 118 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; | 118 int32_t SetRateAllocation(const webrtc::BitrateAllocation& rate_allocation, |
| 119 uint32_t frame_rate) override; |
| 119 | 120 |
| 120 // rtc::MessageHandler implementation. | 121 // rtc::MessageHandler implementation. |
| 121 void OnMessage(rtc::Message* msg) override; | 122 void OnMessage(rtc::Message* msg) override; |
| 122 | 123 |
| 123 void OnDroppedFrame() override; | 124 void OnDroppedFrame() override; |
| 124 | 125 |
| 125 bool SupportsNativeHandle() const override { return egl_context_ != nullptr; } | 126 bool SupportsNativeHandle() const override { return egl_context_ != nullptr; } |
| 126 const char* ImplementationName() const override; | 127 const char* ImplementationName() const override; |
| 127 | 128 |
| 128 private: | 129 private: |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 ALOGD << "EncoderRelease request"; | 462 ALOGD << "EncoderRelease request"; |
| 462 return codec_thread_->Invoke<int32_t>( | 463 return codec_thread_->Invoke<int32_t>( |
| 463 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::ReleaseOnCodecThread, this)); | 464 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::ReleaseOnCodecThread, this)); |
| 464 } | 465 } |
| 465 | 466 |
| 466 int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */, | 467 int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */, |
| 467 int64_t /* rtt */) { | 468 int64_t /* rtt */) { |
| 468 return WEBRTC_VIDEO_CODEC_OK; | 469 return WEBRTC_VIDEO_CODEC_OK; |
| 469 } | 470 } |
| 470 | 471 |
| 471 int32_t MediaCodecVideoEncoder::SetRates(uint32_t new_bit_rate, | 472 int32_t MediaCodecVideoEncoder::SetRateAllocation( |
| 472 uint32_t frame_rate) { | 473 const webrtc::BitrateAllocation& rate_allocation, |
| 474 uint32_t frame_rate) { |
| 473 return codec_thread_->Invoke<int32_t>( | 475 return codec_thread_->Invoke<int32_t>( |
| 474 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::SetRatesOnCodecThread, this, | 476 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::SetRatesOnCodecThread, this, |
| 475 new_bit_rate, frame_rate)); | 477 rate_allocation.get_sum_kbps(), frame_rate)); |
| 476 } | 478 } |
| 477 | 479 |
| 478 void MediaCodecVideoEncoder::OnMessage(rtc::Message* msg) { | 480 void MediaCodecVideoEncoder::OnMessage(rtc::Message* msg) { |
| 479 RTC_DCHECK(codec_thread_checker_.CalledOnValidThread()); | 481 RTC_DCHECK(codec_thread_checker_.CalledOnValidThread()); |
| 480 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 482 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 481 ScopedLocalRefFrame local_ref_frame(jni); | 483 ScopedLocalRefFrame local_ref_frame(jni); |
| 482 | 484 |
| 483 // We only ever send one message to |this| directly (not through a Bind()'d | 485 // We only ever send one message to |this| directly (not through a Bind()'d |
| 484 // functor), so expect no ID/data. | 486 // functor), so expect no ID/data. |
| 485 RTC_CHECK(!msg->message_id) << "Unexpected message!"; | 487 RTC_CHECK(!msg->message_id) << "Unexpected message!"; |
| (...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1380 return supported_codecs_; | 1382 return supported_codecs_; |
| 1381 } | 1383 } |
| 1382 | 1384 |
| 1383 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1385 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
| 1384 webrtc::VideoEncoder* encoder) { | 1386 webrtc::VideoEncoder* encoder) { |
| 1385 ALOGD << "Destroy video encoder."; | 1387 ALOGD << "Destroy video encoder."; |
| 1386 delete encoder; | 1388 delete encoder; |
| 1387 } | 1389 } |
| 1388 | 1390 |
| 1389 } // namespace webrtc_jni | 1391 } // namespace webrtc_jni |
| OLD | NEW |