| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 int32_t /* number_of_cores */, | 105 int32_t /* number_of_cores */, |
| 106 size_t /* max_payload_size */) override; | 106 size_t /* max_payload_size */) override; |
| 107 int32_t Encode(const webrtc::VideoFrame& input_image, | 107 int32_t Encode(const webrtc::VideoFrame& input_image, |
| 108 const webrtc::CodecSpecificInfo* /* codec_specific_info */, | 108 const webrtc::CodecSpecificInfo* /* codec_specific_info */, |
| 109 const std::vector<webrtc::FrameType>* frame_types) override; | 109 const std::vector<webrtc::FrameType>* frame_types) override; |
| 110 int32_t RegisterEncodeCompleteCallback( | 110 int32_t RegisterEncodeCompleteCallback( |
| 111 webrtc::EncodedImageCallback* callback) override; | 111 webrtc::EncodedImageCallback* callback) override; |
| 112 int32_t Release() override; | 112 int32_t Release() override; |
| 113 int32_t SetChannelParameters(uint32_t /* packet_loss */, | 113 int32_t SetChannelParameters(uint32_t /* packet_loss */, |
| 114 int64_t /* rtt */) override; | 114 int64_t /* rtt */) override; |
| 115 int32_t SetRates(uint32_t new_bit_rate, uint32_t frame_rate) override; | 115 int32_t SetRateAllocation(const webrtc::BitrateAllocation& rate_allocation, |
| 116 uint32_t frame_rate) override; |
| 116 | 117 |
| 117 // rtc::MessageHandler implementation. | 118 // rtc::MessageHandler implementation. |
| 118 void OnMessage(rtc::Message* msg) override; | 119 void OnMessage(rtc::Message* msg) override; |
| 119 | 120 |
| 120 void OnDroppedFrame() override; | 121 void OnDroppedFrame() override; |
| 121 | 122 |
| 122 bool SupportsNativeHandle() const override { return egl_context_ != nullptr; } | 123 bool SupportsNativeHandle() const override { return egl_context_ != nullptr; } |
| 123 const char* ImplementationName() const override; | 124 const char* ImplementationName() const override; |
| 124 | 125 |
| 125 private: | 126 private: |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 ALOGD << "EncoderRelease request"; | 459 ALOGD << "EncoderRelease request"; |
| 459 return codec_thread_->Invoke<int32_t>( | 460 return codec_thread_->Invoke<int32_t>( |
| 460 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::ReleaseOnCodecThread, this)); | 461 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::ReleaseOnCodecThread, this)); |
| 461 } | 462 } |
| 462 | 463 |
| 463 int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */, | 464 int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */, |
| 464 int64_t /* rtt */) { | 465 int64_t /* rtt */) { |
| 465 return WEBRTC_VIDEO_CODEC_OK; | 466 return WEBRTC_VIDEO_CODEC_OK; |
| 466 } | 467 } |
| 467 | 468 |
| 468 int32_t MediaCodecVideoEncoder::SetRates(uint32_t new_bit_rate, | 469 int32_t MediaCodecVideoEncoder::SetRateAllocation( |
| 469 uint32_t frame_rate) { | 470 const webrtc::BitrateAllocation& rate_allocation, |
| 471 uint32_t frame_rate) { |
| 470 return codec_thread_->Invoke<int32_t>( | 472 return codec_thread_->Invoke<int32_t>( |
| 471 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::SetRatesOnCodecThread, this, | 473 RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::SetRatesOnCodecThread, this, |
| 472 new_bit_rate, frame_rate)); | 474 rate_allocation.get_sum_kbps(), frame_rate)); |
| 473 } | 475 } |
| 474 | 476 |
| 475 void MediaCodecVideoEncoder::OnMessage(rtc::Message* msg) { | 477 void MediaCodecVideoEncoder::OnMessage(rtc::Message* msg) { |
| 476 RTC_DCHECK(codec_thread_checker_.CalledOnValidThread()); | 478 RTC_DCHECK(codec_thread_checker_.CalledOnValidThread()); |
| 477 JNIEnv* jni = AttachCurrentThreadIfNeeded(); | 479 JNIEnv* jni = AttachCurrentThreadIfNeeded(); |
| 478 ScopedLocalRefFrame local_ref_frame(jni); | 480 ScopedLocalRefFrame local_ref_frame(jni); |
| 479 | 481 |
| 480 // We only ever send one message to |this| directly (not through a Bind()'d | 482 // We only ever send one message to |this| directly (not through a Bind()'d |
| 481 // functor), so expect no ID/data. | 483 // functor), so expect no ID/data. |
| 482 RTC_CHECK(!msg->message_id) << "Unexpected message!"; | 484 RTC_CHECK(!msg->message_id) << "Unexpected message!"; |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 return supported_codecs_; | 1372 return supported_codecs_; |
| 1371 } | 1373 } |
| 1372 | 1374 |
| 1373 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( | 1375 void MediaCodecVideoEncoderFactory::DestroyVideoEncoder( |
| 1374 webrtc::VideoEncoder* encoder) { | 1376 webrtc::VideoEncoder* encoder) { |
| 1375 ALOGD << "Destroy video encoder."; | 1377 ALOGD << "Destroy video encoder."; |
| 1376 delete encoder; | 1378 delete encoder; |
| 1377 } | 1379 } |
| 1378 | 1380 |
| 1379 } // namespace webrtc_jni | 1381 } // namespace webrtc_jni |
| OLD | NEW |