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

Unified Diff: webrtc/video/video_send_stream.cc

Issue 1693553002: Move simple RtpRtcp calls to VideoSendStream. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/vie_channel.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/video_send_stream.cc
diff --git a/webrtc/video/video_send_stream.cc b/webrtc/video/video_send_stream.cc
index 5c3f74fd7e815a7fdf13b194a82130b8698dc2f2..bc141e86afd90f0d904e4e53f1d484729df7e396 100644
--- a/webrtc/video/video_send_stream.cc
+++ b/webrtc/video/video_send_stream.cc
@@ -169,6 +169,7 @@ VideoSendStream::VideoSendStream(
config_.rtp.ssrcs.size(),
true),
vie_receiver_(vie_channel_.vie_receiver()),
+ rtp_rtcp_modules_(vie_channel_.rtp_rtcp()),
input_(&vie_encoder_,
config_.local_renderer,
&stats_proxy_,
@@ -209,27 +210,31 @@ VideoSendStream::VideoSendStream(
}
}
- RtpRtcp* rtp_module = vie_channel_.rtp_rtcp();
- remb_->AddRembSender(rtp_module);
- rtp_module->SetREMBStatus(true);
+ remb_->AddRembSender(rtp_rtcp_modules_[0]);
+ rtp_rtcp_modules_[0]->SetREMBStatus(true);
// Enable NACK, FEC or both.
const bool enable_protection_nack = config_.rtp.nack.rtp_history_ms > 0;
const bool enable_protection_fec = config_.rtp.fec.red_payload_type != -1;
// TODO(changbin): Should set RTX for RED mapping in RTP sender in future.
vie_channel_.SetProtectionMode(enable_protection_nack, enable_protection_fec,
- config_.rtp.fec.red_payload_type,
- config_.rtp.fec.ulpfec_payload_type);
+ config_.rtp.fec.red_payload_type,
+ config_.rtp.fec.ulpfec_payload_type);
vie_encoder_.SetProtectionMethod(enable_protection_nack,
- enable_protection_fec);
+ enable_protection_fec);
ConfigureSsrcs();
- vie_channel_.SetRTCPCName(config_.rtp.c_name.c_str());
-
+ // TODO(pbos): Should we set CNAME on all RTP modules?
+ rtp_rtcp_modules_.front()->SetCNAME(config_.rtp.c_name.c_str());
// 28 to match packet overhead in ModuleRtpRtcpImpl.
RTC_DCHECK_LE(config_.rtp.max_packet_size, static_cast<size_t>(0xFFFF - 28));
- vie_channel_.SetMTU(static_cast<uint16_t>(config_.rtp.max_packet_size + 28));
+ const uint16_t mtu = static_cast<uint16_t>(config_.rtp.max_packet_size + 28);
stefan-webrtc 2016/02/22 13:11:52 Make 28 a named constant.
pbos-webrtc 2016/02/22 13:21:01 Done.
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
+ rtp_rtcp->RegisterRtcpStatisticsCallback(&stats_proxy_);
+ rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(&stats_proxy_);
+ rtp_rtcp->SetMaxTransferUnit(mtu);
+ }
RTC_DCHECK(config.encoder_settings.encoder != nullptr);
RTC_DCHECK_GE(config.encoder_settings.payload_type, 0);
@@ -251,8 +256,6 @@ VideoSendStream::VideoSendStream(
encoder_feedback_.AddEncoder(config_.rtp.ssrcs, &vie_encoder_);
- vie_channel_.RegisterSendChannelRtcpStatisticsCallback(&stats_proxy_);
- vie_channel_.RegisterSendChannelRtpStatisticsCallback(&stats_proxy_);
vie_channel_.RegisterRtcpPacketTypeCounterObserver(&stats_proxy_);
vie_channel_.RegisterSendBitrateObserver(&stats_proxy_);
vie_channel_.RegisterSendFrameCountObserver(&stats_proxy_);
@@ -272,17 +275,12 @@ VideoSendStream::~VideoSendStream() {
vie_channel_.RegisterSendFrameCountObserver(nullptr);
vie_channel_.RegisterSendBitrateObserver(nullptr);
vie_channel_.RegisterRtcpPacketTypeCounterObserver(nullptr);
- vie_channel_.RegisterSendChannelRtpStatisticsCallback(nullptr);
- vie_channel_.RegisterSendChannelRtcpStatisticsCallback(nullptr);
- vie_encoder_.DeRegisterExternalEncoder(
- config_.encoder_settings.payload_type);
+ vie_encoder_.DeRegisterExternalEncoder(config_.encoder_settings.payload_type);
call_stats_->DeregisterStatsObserver(vie_channel_.GetStatsObserver());
-
- RtpRtcp* rtp_module = vie_channel_.rtp_rtcp();
- rtp_module->SetREMBStatus(false);
- remb_->RemoveRembSender(rtp_module);
+ rtp_rtcp_modules_[0]->SetREMBStatus(false);
+ remb_->RemoveRembSender(rtp_rtcp_modules_[0]);
// Remove the feedback, stop all encoding threads and processing. This must be
// done before deleting the channel.
@@ -485,39 +483,49 @@ void VideoSendStream::NormalUsage() {
}
void VideoSendStream::ConfigureSsrcs() {
- vie_channel_.SetSSRC(config_.rtp.ssrcs.front(), kViEStreamTypeNormal, 0);
+ // Configure regular SSRCs.
for (size_t i = 0; i < config_.rtp.ssrcs.size(); ++i) {
uint32_t ssrc = config_.rtp.ssrcs[i];
- vie_channel_.SetSSRC(ssrc, kViEStreamTypeNormal,
- static_cast<unsigned char>(i));
+ RtpRtcp* const rtp_rtcp = rtp_rtcp_modules_[i];
+ rtp_rtcp->SetSSRC(ssrc);
+
+ // Restore RTP state if previous existed.
RtpStateMap::iterator it = suspended_ssrcs_.find(ssrc);
if (it != suspended_ssrcs_.end())
- vie_channel_.SetRtpStateForSsrc(ssrc, it->second);
+ rtp_rtcp->SetRtpStateForSsrc(ssrc, it->second);
}
- if (config_.rtp.rtx.ssrcs.empty()) {
+ // Set up RTX if available.
+ if (config_.rtp.rtx.ssrcs.empty())
return;
- }
- // Set up RTX.
+ // Configure RTX SSRCs.
RTC_DCHECK_EQ(config_.rtp.rtx.ssrcs.size(), config_.rtp.ssrcs.size());
for (size_t i = 0; i < config_.rtp.rtx.ssrcs.size(); ++i) {
uint32_t ssrc = config_.rtp.rtx.ssrcs[i];
- vie_channel_.SetSSRC(config_.rtp.rtx.ssrcs[i], kViEStreamTypeRtx,
- static_cast<unsigned char>(i));
+ RtpRtcp* const rtp_rtcp = rtp_rtcp_modules_[i];
+ rtp_rtcp->SetRtxSsrc(ssrc);
RtpStateMap::iterator it = suspended_ssrcs_.find(ssrc);
if (it != suspended_ssrcs_.end())
- vie_channel_.SetRtpStateForSsrc(ssrc, it->second);
+ rtp_rtcp->SetRtpStateForSsrc(ssrc, it->second);
}
+ // Configure RTX payload types.
RTC_DCHECK_GE(config_.rtp.rtx.payload_type, 0);
- vie_channel_.SetRtxSendPayloadType(config_.rtp.rtx.payload_type,
- config_.encoder_settings.payload_type);
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
+ rtp_rtcp->SetRtxSendPayloadType(config_.rtp.rtx.payload_type,
+ config_.encoder_settings.payload_type);
+ }
if (config_.rtp.fec.red_payload_type != -1 &&
config_.rtp.fec.red_rtx_payload_type != -1) {
- vie_channel_.SetRtxSendPayloadType(config_.rtp.fec.red_rtx_payload_type,
- config_.rtp.fec.red_payload_type);
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) {
+ rtp_rtcp->SetRtxSendPayloadType(config_.rtp.fec.red_rtx_payload_type,
+ config_.rtp.fec.red_payload_type);
+ }
}
+ // Enable RTX in RTP modules.
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
+ rtp_rtcp->SetRtxSendStatus(kRtxRetransmitted | kRtxRedundantPayloads);
stefan-webrtc 2016/02/22 13:11:52 I think you can move this to line 524 or 517
pbos-webrtc 2016/02/22 13:21:01 Done.
}
std::map<uint32_t, RtpState> VideoSendStream::GetRtpStates() const {
@@ -539,11 +547,15 @@ void VideoSendStream::SignalNetworkState(NetworkState state) {
// When network goes up, enable RTCP status before setting transmission state.
// When it goes down, disable RTCP afterwards. This ensures that any packets
// sent due to the network state changed will not be dropped.
- if (state == kNetworkUp)
- vie_channel_.SetRTCPMode(config_.rtp.rtcp_mode);
+ if (state == kNetworkUp) {
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
+ rtp_rtcp->SetRTCPStatus(config_.rtp.rtcp_mode);
+ }
vie_encoder_.SetNetworkTransmissionState(state == kNetworkUp);
- if (state == kNetworkDown)
- vie_channel_.SetRTCPMode(RtcpMode::kOff);
+ if (state == kNetworkDown) {
+ for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
+ rtp_rtcp->SetRTCPStatus(RtcpMode::kOff);
+ }
}
int64_t VideoSendStream::GetRtt() const {
@@ -554,8 +566,8 @@ int64_t VideoSendStream::GetRtt() const {
uint32_t jitter;
int64_t rtt_ms;
if (vie_channel_.GetSendRtcpStatistics(&frac_lost, &cumulative_lost,
- &extended_max_sequence_number,
- &jitter, &rtt_ms) == 0) {
+ &extended_max_sequence_number, &jitter,
+ &rtt_ms) == 0) {
return rtt_ms;
}
return -1;
« no previous file with comments | « webrtc/video/video_send_stream.h ('k') | webrtc/video/vie_channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698