Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: webrtc/video/video_send_stream.cc

Issue 2304363002: Let ViEEncoder express resolution requests as Sinkwants (Closed)
Patch Set: Rebased. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 #include "webrtc/video/video_send_stream.h" 10 #include "webrtc/video/video_send_stream.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 RtcEventLog* event_log, 520 RtcEventLog* event_log,
521 VideoSendStream::Config config, 521 VideoSendStream::Config config,
522 VideoEncoderConfig encoder_config, 522 VideoEncoderConfig encoder_config,
523 const std::map<uint32_t, RtpState>& suspended_ssrcs) 523 const std::map<uint32_t, RtpState>& suspended_ssrcs)
524 : worker_queue_(worker_queue), 524 : worker_queue_(worker_queue),
525 thread_sync_event_(false /* manual_reset */, false), 525 thread_sync_event_(false /* manual_reset */, false),
526 stats_proxy_(Clock::GetRealTimeClock(), 526 stats_proxy_(Clock::GetRealTimeClock(),
527 config, 527 config,
528 encoder_config.content_type), 528 encoder_config.content_type),
529 config_(std::move(config)) { 529 config_(std::move(config)) {
530 vie_encoder_.reset( 530 vie_encoder_.reset(new ViEEncoder(
531 new ViEEncoder(num_cpu_cores, &stats_proxy_, config_.encoder_settings, 531 num_cpu_cores, &stats_proxy_, config_.encoder_settings,
532 config_.pre_encode_callback, config_.overuse_callback, 532 config_.pre_encode_callback, config_.post_encode_callback));
533 config_.post_encode_callback));
534 533
535 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( 534 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask(
536 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), 535 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(),
537 module_process_thread, call_stats, congestion_controller, 536 module_process_thread, call_stats, congestion_controller,
538 bitrate_allocator, send_delay_stats, remb, event_log, &config_, 537 bitrate_allocator, send_delay_stats, remb, event_log, &config_,
539 encoder_config.max_bitrate_bps, suspended_ssrcs))); 538 encoder_config.max_bitrate_bps, suspended_ssrcs)));
540 539
541 // Wait for ConstructionTask to complete so that |send_stream_| can be used. 540 // Wait for ConstructionTask to complete so that |send_stream_| can be used.
542 // |module_process_thread| must be registered and deregistered on the thread 541 // |module_process_thread| must be registered and deregistered on the thread
543 // it was created on. 542 // it was created on.
(...skipping 26 matching lines...) Expand all
570 } 569 }
571 570
572 void VideoSendStream::Stop() { 571 void VideoSendStream::Stop() {
573 RTC_DCHECK_RUN_ON(&thread_checker_); 572 RTC_DCHECK_RUN_ON(&thread_checker_);
574 LOG(LS_INFO) << "VideoSendStream::Stop"; 573 LOG(LS_INFO) << "VideoSendStream::Stop";
575 VideoSendStreamImpl* send_stream = send_stream_.get(); 574 VideoSendStreamImpl* send_stream = send_stream_.get();
576 worker_queue_->PostTask([send_stream] { send_stream->Stop(); }); 575 worker_queue_->PostTask([send_stream] { send_stream->Stop(); });
577 } 576 }
578 577
579 void VideoSendStream::SetSource( 578 void VideoSendStream::SetSource(
580 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { 579 rtc::VideoSourceInterface<webrtc::VideoFrame>* source,
580 const DegradationPreference& degradation_preference) {
581 RTC_DCHECK_RUN_ON(&thread_checker_); 581 RTC_DCHECK_RUN_ON(&thread_checker_);
582 vie_encoder_->SetSource(source); 582 vie_encoder_->SetSource(source, degradation_preference);
583 } 583 }
584 584
585 void VideoSendStream::ReconfigureVideoEncoder(VideoEncoderConfig config) { 585 void VideoSendStream::ReconfigureVideoEncoder(VideoEncoderConfig config) {
586 // TODO(perkj): Some test cases in VideoSendStreamTest call 586 // TODO(perkj): Some test cases in VideoSendStreamTest call
587 // ReconfigureVideoEncoder from the network thread. 587 // ReconfigureVideoEncoder from the network thread.
588 // RTC_DCHECK_RUN_ON(&thread_checker_); 588 // RTC_DCHECK_RUN_ON(&thread_checker_);
589 vie_encoder_->ConfigureEncoder(std::move(config), 589 vie_encoder_->ConfigureEncoder(std::move(config),
590 config_.rtp.max_packet_size); 590 config_.rtp.max_packet_size);
591 } 591 }
592 592
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 rtp_rtcp->RegisterVideoSendPayload( 726 rtp_rtcp->RegisterVideoSendPayload(
727 config_->encoder_settings.payload_type, 727 config_->encoder_settings.payload_type,
728 config_->encoder_settings.payload_name.c_str()); 728 config_->encoder_settings.payload_name.c_str());
729 } 729 }
730 730
731 RTC_DCHECK(config_->encoder_settings.encoder); 731 RTC_DCHECK(config_->encoder_settings.encoder);
732 RTC_DCHECK_GE(config_->encoder_settings.payload_type, 0); 732 RTC_DCHECK_GE(config_->encoder_settings.payload_type, 0);
733 RTC_DCHECK_LE(config_->encoder_settings.payload_type, 127); 733 RTC_DCHECK_LE(config_->encoder_settings.payload_type, 127);
734 734
735 vie_encoder_->SetStartBitrate(bitrate_allocator_->GetStartBitrate(this)); 735 vie_encoder_->SetStartBitrate(bitrate_allocator_->GetStartBitrate(this));
736 vie_encoder_->SetSink(this); 736
737 // Only request rotation at the source when we positively know that the remote
738 // side doesn't support the rotation extension. This allows us to prepare the
739 // encoder in the expectation that rotation is supported - which is the common
740 // case.
741 bool rotation_applied =
742 std::find_if(config_->rtp.extensions.begin(),
743 config_->rtp.extensions.end(),
744 [](const RtpExtension& extension) {
745 return extension.uri == RtpExtension::kVideoRotationUri;
746 }) == config_->rtp.extensions.end();
747
748 vie_encoder_->SetSink(this, rotation_applied);
737 } 749 }
738 750
739 void VideoSendStreamImpl::RegisterProcessThread( 751 void VideoSendStreamImpl::RegisterProcessThread(
740 ProcessThread* module_process_thread) { 752 ProcessThread* module_process_thread) {
741 RTC_DCHECK_RUN_ON(&module_process_thread_checker_); 753 RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
742 RTC_DCHECK(!module_process_thread_); 754 RTC_DCHECK(!module_process_thread_);
743 module_process_thread_ = module_process_thread; 755 module_process_thread_ = module_process_thread;
744 756
745 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) 757 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
746 module_process_thread_->RegisterModule(rtp_rtcp); 758 module_process_thread_->RegisterModule(rtp_rtcp);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 &module_nack_rate); 1119 &module_nack_rate);
1108 *sent_video_rate_bps += module_video_rate; 1120 *sent_video_rate_bps += module_video_rate;
1109 *sent_nack_rate_bps += module_nack_rate; 1121 *sent_nack_rate_bps += module_nack_rate;
1110 *sent_fec_rate_bps += module_fec_rate; 1122 *sent_fec_rate_bps += module_fec_rate;
1111 } 1123 }
1112 return 0; 1124 return 0;
1113 } 1125 }
1114 1126
1115 } // namespace internal 1127 } // namespace internal
1116 } // namespace webrtc 1128 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698