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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 // When network goes up, enable RTCP status before setting transmission state. | 565 // When network goes up, enable RTCP status before setting transmission state. |
566 // When it goes down, disable RTCP afterwards. This ensures that any packets | 566 // When it goes down, disable RTCP afterwards. This ensures that any packets |
567 // sent due to the network state changed will not be dropped. | 567 // sent due to the network state changed will not be dropped. |
568 if (state == kNetworkUp) | 568 if (state == kNetworkUp) |
569 vie_channel_.SetRTCPMode(config_.rtp.rtcp_mode); | 569 vie_channel_.SetRTCPMode(config_.rtp.rtcp_mode); |
570 vie_encoder_.SetNetworkTransmissionState(state == kNetworkUp); | 570 vie_encoder_.SetNetworkTransmissionState(state == kNetworkUp); |
571 if (state == kNetworkDown) | 571 if (state == kNetworkDown) |
572 vie_channel_.SetRTCPMode(RtcpMode::kOff); | 572 vie_channel_.SetRTCPMode(RtcpMode::kOff); |
573 } | 573 } |
574 | 574 |
575 int64_t VideoSendStream::GetRtt() const { | |
576 webrtc::RtcpStatistics rtcp_stats; | |
577 uint16_t frac_lost; | |
578 uint32_t cumulative_lost; | |
579 uint32_t extended_max_sequence_number; | |
580 uint32_t jitter; | |
581 int64_t rtt_ms; | |
582 if (vie_channel_.GetSendRtcpStatistics(&frac_lost, &cumulative_lost, | |
583 &extended_max_sequence_number, | |
584 &jitter, &rtt_ms) == 0) { | |
585 return rtt_ms; | |
586 } | |
587 return -1; | |
588 } | |
589 | |
590 int VideoSendStream::GetPaddingNeededBps() const { | 575 int VideoSendStream::GetPaddingNeededBps() const { |
591 return vie_encoder_.GetPaddingNeededBps(); | 576 return vie_encoder_.GetPaddingNeededBps(); |
592 } | 577 } |
593 | 578 |
594 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { | 579 bool VideoSendStream::SetSendCodec(VideoCodec video_codec) { |
595 static const int kEncoderMinBitrate = 30; | 580 static const int kEncoderMinBitrate = 30; |
596 if (video_codec.maxBitrate == 0) { | 581 if (video_codec.maxBitrate == 0) { |
597 // Unset max bitrate -> cap to one bit per pixel. | 582 // Unset max bitrate -> cap to one bit per pixel. |
598 video_codec.maxBitrate = | 583 video_codec.maxBitrate = |
599 (video_codec.width * video_codec.height * video_codec.maxFramerate) / | 584 (video_codec.width * video_codec.height * video_codec.maxFramerate) / |
(...skipping 24 matching lines...) Expand all Loading... |
624 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); | 609 used_ssrcs.resize(static_cast<size_t>(video_codec.numberOfSimulcastStreams)); |
625 vie_encoder_.SetSsrcs(used_ssrcs); | 610 vie_encoder_.SetSsrcs(used_ssrcs); |
626 | 611 |
627 // Restart the media flow | 612 // Restart the media flow |
628 vie_encoder_.Restart(); | 613 vie_encoder_.Restart(); |
629 | 614 |
630 return true; | 615 return true; |
631 } | 616 } |
632 } // namespace internal | 617 } // namespace internal |
633 } // namespace webrtc | 618 } // namespace webrtc |
OLD | NEW |