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

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

Issue 1751363003: Move all calls after SetEncoder into SetEncoder. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | webrtc/video/vie_encoder.h » ('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 10
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 } 352 }
353 353
354 void VideoSendStream::ReconfigureVideoEncoder( 354 void VideoSendStream::ReconfigureVideoEncoder(
355 const VideoEncoderConfig& config) { 355 const VideoEncoderConfig& config) {
356 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder"); 356 TRACE_EVENT0("webrtc", "VideoSendStream::(Re)configureVideoEncoder");
357 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString(); 357 LOG(LS_INFO) << "(Re)configureVideoEncoder: " << config.ToString();
358 const std::vector<VideoStream>& streams = config.streams; 358 const std::vector<VideoStream>& streams = config.streams;
359 static const int kEncoderMinBitrateKbps = 30; 359 static const int kEncoderMinBitrateKbps = 30;
360 RTC_DCHECK(!streams.empty()); 360 RTC_DCHECK(!streams.empty());
361 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), streams.size()); 361 RTC_DCHECK_GE(config_.rtp.ssrcs.size(), streams.size());
362 RTC_DCHECK_GE(config.min_transmit_bitrate_bps, 0);
362 363
363 VideoCodec video_codec; 364 VideoCodec video_codec;
364 memset(&video_codec, 0, sizeof(video_codec)); 365 memset(&video_codec, 0, sizeof(video_codec));
365 video_codec.codecType = 366 video_codec.codecType =
366 PayloadNameToCodecType(config_.encoder_settings.payload_name); 367 PayloadNameToCodecType(config_.encoder_settings.payload_name);
367 368
368 switch (config.content_type) { 369 switch (config.content_type) {
369 case VideoEncoderConfig::ContentType::kRealtimeVideo: 370 case VideoEncoderConfig::ContentType::kRealtimeVideo:
370 video_codec.mode = kRealtimeVideo; 371 video_codec.mode = kRealtimeVideo;
371 break; 372 break;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 video_codec.maxBitrate = 480 video_codec.maxBitrate =
480 (video_codec.width * video_codec.height * video_codec.maxFramerate) / 481 (video_codec.width * video_codec.height * video_codec.maxFramerate) /
481 1000; 482 1000;
482 } 483 }
483 if (video_codec.maxBitrate < kEncoderMinBitrateKbps) 484 if (video_codec.maxBitrate < kEncoderMinBitrateKbps)
484 video_codec.maxBitrate = kEncoderMinBitrateKbps; 485 video_codec.maxBitrate = kEncoderMinBitrateKbps;
485 486
486 RTC_DCHECK_GT(streams[0].max_framerate, 0); 487 RTC_DCHECK_GT(streams[0].max_framerate, 0);
487 video_codec.maxFramerate = streams[0].max_framerate; 488 video_codec.maxFramerate = streams[0].max_framerate;
488 489
489 vie_encoder_.SetEncoder(video_codec); 490 vie_encoder_.SetEncoder(video_codec, config.min_transmit_bitrate_bps);
490
491 // Clear stats for disabled layers.
492 for (size_t i = video_codec.numberOfSimulcastStreams;
493 i < config_.rtp.ssrcs.size(); ++i) {
494 stats_proxy_.OnInactiveSsrc(config_.rtp.ssrcs[i]);
495 }
496
497 stats_proxy_.SetContentType(config.content_type);
498
499 RTC_DCHECK_GE(config.min_transmit_bitrate_bps, 0);
500 vie_encoder_.SetMinTransmitBitrate(config.min_transmit_bitrate_bps / 1000);
501 } 491 }
502 492
503 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) { 493 bool VideoSendStream::DeliverRtcp(const uint8_t* packet, size_t length) {
504 return vie_receiver_->DeliverRtcp(packet, length); 494 return vie_receiver_->DeliverRtcp(packet, length);
505 } 495 }
506 496
507 VideoSendStream::Stats VideoSendStream::GetStats() { 497 VideoSendStream::Stats VideoSendStream::GetStats() {
508 return stats_proxy_.GetStats(); 498 return stats_proxy_.GetStats();
509 } 499 }
510 500
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) 580 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
591 rtp_rtcp->SetRTCPStatus(RtcpMode::kOff); 581 rtp_rtcp->SetRTCPStatus(RtcpMode::kOff);
592 } 582 }
593 } 583 }
594 584
595 int VideoSendStream::GetPaddingNeededBps() const { 585 int VideoSendStream::GetPaddingNeededBps() const {
596 return vie_encoder_.GetPaddingNeededBps(); 586 return vie_encoder_.GetPaddingNeededBps();
597 } 587 }
598 } // namespace internal 588 } // namespace internal
599 } // namespace webrtc 589 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/video/vie_encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698