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

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

Issue 2383493005: Revert of Let ViEEncoder handle resolution changes. (Closed)
Patch Set: Created 4 years, 2 months 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_quality_test.cc ('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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 thread_sync_event_(false /* manual_reset */, false), 514 thread_sync_event_(false /* manual_reset */, false),
515 stats_proxy_(Clock::GetRealTimeClock(), 515 stats_proxy_(Clock::GetRealTimeClock(),
516 config, 516 config,
517 encoder_config.content_type), 517 encoder_config.content_type),
518 config_(std::move(config)) { 518 config_(std::move(config)) {
519 vie_encoder_.reset( 519 vie_encoder_.reset(
520 new ViEEncoder(num_cpu_cores, &stats_proxy_, config_.encoder_settings, 520 new ViEEncoder(num_cpu_cores, &stats_proxy_, config_.encoder_settings,
521 config_.pre_encode_callback, config_.overuse_callback, 521 config_.pre_encode_callback, config_.overuse_callback,
522 config_.post_encode_callback)); 522 config_.post_encode_callback));
523 523
524 // TODO(perkj): Remove vector<VideoStreams> from VideoEncoderConfig and
525 // replace with max_bitrate. The VideoStream should be created by ViEEncoder
526 // when the video resolution is known.
527 int initial_max_encoder_bitrate = 0;
528 for (const auto& stream : encoder_config.streams)
529 initial_max_encoder_bitrate += stream.max_bitrate_bps;
530
524 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask( 531 worker_queue_->PostTask(std::unique_ptr<rtc::QueuedTask>(new ConstructionTask(
525 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(), 532 &send_stream_, &thread_sync_event_, &stats_proxy_, vie_encoder_.get(),
526 module_process_thread, call_stats, congestion_controller, 533 module_process_thread, call_stats, congestion_controller,
527 bitrate_allocator, send_delay_stats, remb, event_log, &config_, 534 bitrate_allocator, send_delay_stats, remb, event_log, &config_,
528 encoder_config.max_bitrate_bps, suspended_ssrcs))); 535 initial_max_encoder_bitrate, suspended_ssrcs)));
529 536
530 // Wait for ConstructionTask to complete so that |send_stream_| can be used. 537 // Wait for ConstructionTask to complete so that |send_stream_| can be used.
531 // |module_process_thread| must be registered and deregistered on the thread 538 // |module_process_thread| must be registered and deregistered on the thread
532 // it was created on. 539 // it was created on.
533 thread_sync_event_.Wait(rtc::Event::kForever); 540 thread_sync_event_.Wait(rtc::Event::kForever);
534 send_stream_->RegisterProcessThread(module_process_thread); 541 send_stream_->RegisterProcessThread(module_process_thread);
535 542
536 vie_encoder_->RegisterProcessThread(module_process_thread); 543 vie_encoder_->RegisterProcessThread(module_process_thread);
537 544
538 ReconfigureVideoEncoder(std::move(encoder_config)); 545 ReconfigureVideoEncoder(std::move(encoder_config));
(...skipping 26 matching lines...) Expand all
565 worker_queue_->PostTask([send_stream] { send_stream->Stop(); }); 572 worker_queue_->PostTask([send_stream] { send_stream->Stop(); });
566 } 573 }
567 574
568 void VideoSendStream::SetSource( 575 void VideoSendStream::SetSource(
569 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { 576 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) {
570 RTC_DCHECK_RUN_ON(&thread_checker_); 577 RTC_DCHECK_RUN_ON(&thread_checker_);
571 vie_encoder_->SetSource(source); 578 vie_encoder_->SetSource(source);
572 } 579 }
573 580
574 void VideoSendStream::ReconfigureVideoEncoder(VideoEncoderConfig config) { 581 void VideoSendStream::ReconfigureVideoEncoder(VideoEncoderConfig config) {
575 // TODO(perkj): Some test cases in VideoSendStreamTest call 582 // ReconfigureVideoEncoder will be called on the thread that deliverers video
576 // ReconfigureVideoEncoder from the network thread. 583 // frames. We must change the encoder settings immediately so that
577 // RTC_DCHECK_RUN_ON(&thread_checker_); 584 // the codec settings matches the next frame.
585 // TODO(perkj): Move logic for reconfiguration the encoder due to frame size
586 // change from WebRtcVideoChannel2::WebRtcVideoSendStream::OnFrame to
587 // be internally handled by ViEEncoder.
578 vie_encoder_->ConfigureEncoder(std::move(config), 588 vie_encoder_->ConfigureEncoder(std::move(config),
579 config_.rtp.max_packet_size); 589 config_.rtp.max_packet_size);
580 } 590 }
581 591
582 VideoSendStream::Stats VideoSendStream::GetStats() { 592 VideoSendStream::Stats VideoSendStream::GetStats() {
583 // TODO(perkj, solenberg): Some test cases in EndToEndTest call GetStats from 593 // TODO(perkj, solenberg): Some test cases in EndToEndTest call GetStats from
584 // a network thread. See comment in Call::GetStats(). 594 // a network thread. See comment in Call::GetStats().
585 // RTC_DCHECK_RUN_ON(&thread_checker_); 595 // RTC_DCHECK_RUN_ON(&thread_checker_);
586 return stats_proxy_.GetStats(); 596 return stats_proxy_.GetStats();
587 } 597 }
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 &module_nack_rate); 1108 &module_nack_rate);
1099 *sent_video_rate_bps += module_video_rate; 1109 *sent_video_rate_bps += module_video_rate;
1100 *sent_nack_rate_bps += module_nack_rate; 1110 *sent_nack_rate_bps += module_nack_rate;
1101 *sent_fec_rate_bps += module_fec_rate; 1111 *sent_fec_rate_bps += module_fec_rate;
1102 } 1112 }
1103 return 0; 1113 return 0;
1104 } 1114 }
1105 1115
1106 } // namespace internal 1116 } // namespace internal
1107 } // namespace webrtc 1117 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.cc ('k') | webrtc/video/video_send_stream_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698