| OLD | NEW |
| 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // When network goes up, enable RTCP status before setting transmission state. | 515 // When network goes up, enable RTCP status before setting transmission state. |
| 516 // When it goes down, disable RTCP afterwards. This ensures that any packets | 516 // When it goes down, disable RTCP afterwards. This ensures that any packets |
| 517 // sent due to the network state changed will not be dropped. | 517 // sent due to the network state changed will not be dropped. |
| 518 if (state == kNetworkUp) | 518 if (state == kNetworkUp) |
| 519 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode); | 519 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode); |
| 520 vie_encoder_->SetNetworkTransmissionState(state == kNetworkUp); | 520 vie_encoder_->SetNetworkTransmissionState(state == kNetworkUp); |
| 521 if (state == kNetworkDown) | 521 if (state == kNetworkDown) |
| 522 vie_channel_->SetRTCPMode(RtcpMode::kOff); | 522 vie_channel_->SetRTCPMode(RtcpMode::kOff); |
| 523 } | 523 } |
| 524 | 524 |
| 525 int64_t VideoSendStream::GetRtt() const { | |
| 526 webrtc::RtcpStatistics rtcp_stats; | |
| 527 uint16_t frac_lost; | |
| 528 uint32_t cumulative_lost; | |
| 529 uint32_t extended_max_sequence_number; | |
| 530 uint32_t jitter; | |
| 531 int64_t rtt_ms; | |
| 532 if (vie_channel_->GetSendRtcpStatistics(&frac_lost, &cumulative_lost, | |
| 533 &extended_max_sequence_number, | |
| 534 &jitter, &rtt_ms) == 0) { | |
| 535 return rtt_ms; | |
| 536 } | |
| 537 return -1; | |
| 538 } | |
| 539 | |
| 540 int VideoSendStream::GetPaddingNeededBps() const { | 525 int VideoSendStream::GetPaddingNeededBps() const { |
| 541 return vie_encoder_->GetPaddingNeededBps(); | 526 return vie_encoder_->GetPaddingNeededBps(); |
| 542 } | 527 } |
| 543 | 528 |
| 544 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { | 529 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { |
| 545 static const int kEncoderMinBitrate = 30; | 530 static const int kEncoderMinBitrate = 30; |
| 546 if (video_codec.maxBitrate == 0) { | 531 if (video_codec.maxBitrate == 0) { |
| 547 // Unset max bitrate -> cap to one bit per pixel. | 532 // Unset max bitrate -> cap to one bit per pixel. |
| 548 video_codec.maxBitrate = | 533 video_codec.maxBitrate = |
| 549 (video_codec.width * video_codec.height * video_codec.maxFramerate) / | 534 (video_codec.width * video_codec.height * video_codec.maxFramerate) / |
| (...skipping 25 matching lines...) Expand all Loading... |
| 575 vie_encoder_->SetSsrcs(used_ssrcs); | 560 vie_encoder_->SetSsrcs(used_ssrcs); |
| 576 | 561 |
| 577 // Restart the media flow | 562 // Restart the media flow |
| 578 vie_encoder_->Restart(); | 563 vie_encoder_->Restart(); |
| 579 | 564 |
| 580 return true; | 565 return true; |
| 581 } | 566 } |
| 582 | 567 |
| 583 } // namespace internal | 568 } // namespace internal |
| 584 } // namespace webrtc | 569 } // namespace webrtc |
| OLD | NEW |