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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // When network goes up, enable RTCP status before setting transmission state. | 543 // When network goes up, enable RTCP status before setting transmission state. |
544 // When it goes down, disable RTCP afterwards. This ensures that any packets | 544 // When it goes down, disable RTCP afterwards. This ensures that any packets |
545 // sent due to the network state changed will not be dropped. | 545 // sent due to the network state changed will not be dropped. |
546 if (state == kNetworkUp) | 546 if (state == kNetworkUp) |
547 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode); | 547 vie_channel_->SetRTCPMode(config_.rtp.rtcp_mode); |
548 vie_encoder_->SetNetworkTransmissionState(state == kNetworkUp); | 548 vie_encoder_->SetNetworkTransmissionState(state == kNetworkUp); |
549 if (state == kNetworkDown) | 549 if (state == kNetworkDown) |
550 vie_channel_->SetRTCPMode(RtcpMode::kOff); | 550 vie_channel_->SetRTCPMode(RtcpMode::kOff); |
551 } | 551 } |
552 | 552 |
553 int64_t VideoSendStream::GetRtt() const { | |
554 webrtc::RtcpStatistics rtcp_stats; | |
555 uint16_t frac_lost; | |
556 uint32_t cumulative_lost; | |
557 uint32_t extended_max_sequence_number; | |
558 uint32_t jitter; | |
559 int64_t rtt_ms; | |
560 if (vie_channel_->GetSendRtcpStatistics(&frac_lost, &cumulative_lost, | |
561 &extended_max_sequence_number, | |
562 &jitter, &rtt_ms) == 0) { | |
563 return rtt_ms; | |
564 } | |
565 return -1; | |
566 } | |
567 | |
568 int VideoSendStream::GetPaddingNeededBps() const { | 553 int VideoSendStream::GetPaddingNeededBps() const { |
569 return vie_encoder_->GetPaddingNeededBps(); | 554 return vie_encoder_->GetPaddingNeededBps(); |
570 } | 555 } |
571 | 556 |
572 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { | 557 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { |
573 static const int kEncoderMinBitrate = 30; | 558 static const int kEncoderMinBitrate = 30; |
574 if (video_codec.maxBitrate == 0) { | 559 if (video_codec.maxBitrate == 0) { |
575 // Unset max bitrate -> cap to one bit per pixel. | 560 // Unset max bitrate -> cap to one bit per pixel. |
576 video_codec.maxBitrate = | 561 video_codec.maxBitrate = |
577 (video_codec.width * video_codec.height * video_codec.maxFramerate) / | 562 (video_codec.width * video_codec.height * video_codec.maxFramerate) / |
(...skipping 25 matching lines...) Expand all Loading... |
603 vie_encoder_->SetSsrcs(used_ssrcs); | 588 vie_encoder_->SetSsrcs(used_ssrcs); |
604 | 589 |
605 // Restart the media flow | 590 // Restart the media flow |
606 vie_encoder_->Restart(); | 591 vie_encoder_->Restart(); |
607 | 592 |
608 return true; | 593 return true; |
609 } | 594 } |
610 | 595 |
611 } // namespace internal | 596 } // namespace internal |
612 } // namespace webrtc | 597 } // namespace webrtc |
OLD | NEW |