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

Unified Diff: webrtc/video/payload_router.cc

Issue 2338133003: Let ViEEncoder tell VideoSendStream about reconfigurations. (Closed)
Patch Set: Rebased Created 4 years, 3 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/payload_router.h ('k') | webrtc/video/payload_router_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/video/payload_router.cc
diff --git a/webrtc/video/payload_router.cc b/webrtc/video/payload_router.cc
index 5bcf70532fe819fc338947ee65a85b71caed47f9..2cc3e887b59e1da3254adf04b826574153ee23d7 100644
--- a/webrtc/video/payload_router.cc
+++ b/webrtc/video/payload_router.cc
@@ -90,10 +90,8 @@ void CopyCodecSpecific(const CodecSpecificInfo* info, RTPVideoHeader* rtp) {
PayloadRouter::PayloadRouter(const std::vector<RtpRtcp*>& rtp_modules,
int payload_type)
: active_(false),
- num_sending_modules_(1),
rtp_modules_(rtp_modules),
payload_type_(payload_type) {
- UpdateModuleSendingState();
}
PayloadRouter::~PayloadRouter() {}
@@ -108,7 +106,11 @@ void PayloadRouter::set_active(bool active) {
if (active_ == active)
return;
active_ = active;
- UpdateModuleSendingState();
+
+ for (auto& module : rtp_modules_) {
+ module->SetSendingStatus(active_);
+ module->SetSendingMediaStatus(active_);
+ }
}
bool PayloadRouter::active() {
@@ -116,34 +118,13 @@ bool PayloadRouter::active() {
return active_ && !rtp_modules_.empty();
}
-void PayloadRouter::SetSendStreams(const std::vector<VideoStream>& streams) {
- RTC_DCHECK_LE(streams.size(), rtp_modules_.size());
- rtc::CritScope lock(&crit_);
- num_sending_modules_ = streams.size();
- streams_ = streams;
- // TODO(perkj): Should SetSendStreams also call SetTargetSendBitrate?
- UpdateModuleSendingState();
-}
-
-void PayloadRouter::UpdateModuleSendingState() {
- for (size_t i = 0; i < num_sending_modules_; ++i) {
- rtp_modules_[i]->SetSendingStatus(active_);
- rtp_modules_[i]->SetSendingMediaStatus(active_);
- }
- // Disable inactive modules.
- for (size_t i = num_sending_modules_; i < rtp_modules_.size(); ++i) {
- rtp_modules_[i]->SetSendingStatus(false);
- rtp_modules_[i]->SetSendingMediaStatus(false);
- }
-}
-
EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
const EncodedImage& encoded_image,
const CodecSpecificInfo* codec_specific_info,
const RTPFragmentationHeader* fragmentation) {
rtc::CritScope lock(&crit_);
RTC_DCHECK(!rtp_modules_.empty());
- if (!active_ || num_sending_modules_ == 0)
+ if (!active_)
return Result(Result::ERROR_SEND_FAILED);
int stream_index = 0;
@@ -154,12 +135,6 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
CopyCodecSpecific(codec_specific_info, &rtp_video_header);
rtp_video_header.rotation = encoded_image.rotation_;
rtp_video_header.playout_delay = encoded_image.playout_delay_;
-
- RTC_DCHECK_LT(rtp_video_header.simulcastIdx, rtp_modules_.size());
- // The simulcast index might actually be larger than the number of modules
- // in case the encoder was processing a frame during a codec reconfig.
- if (rtp_video_header.simulcastIdx >= num_sending_modules_)
- return Result(Result::ERROR_SEND_FAILED);
stream_index = rtp_video_header.simulcastIdx;
uint32_t frame_id;
@@ -168,6 +143,7 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
encoded_image.capture_time_ms_, encoded_image._buffer,
encoded_image._length, fragmentation, &rtp_video_header, &frame_id);
+ RTC_DCHECK_LT(rtp_video_header.simulcastIdx, rtp_modules_.size());
if (send_result < 0)
return Result(Result::ERROR_SEND_FAILED);
@@ -177,7 +153,7 @@ EncodedImageCallback::Result PayloadRouter::OnEncodedImage(
size_t PayloadRouter::MaxPayloadLength() const {
size_t min_payload_length = DefaultMaxPayloadLength();
rtc::CritScope lock(&crit_);
- for (size_t i = 0; i < num_sending_modules_; ++i) {
+ for (size_t i = 0; i < rtp_modules_.size(); ++i) {
size_t module_payload_length = rtp_modules_[i]->MaxDataPayloadLength();
if (module_payload_length < min_payload_length)
min_payload_length = module_payload_length;
« no previous file with comments | « webrtc/video/payload_router.h ('k') | webrtc/video/payload_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698