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