Fix PayloadRouter::OnEncodedImage() to handle errors properly.
PayloadRouter::OnEncodedImage() was casing boolean result from
SendOutgoingData() to int, and then not handling it correctly, which
results in all errors in SendOutgoingData() being ignored. This issue
was introduced in
https://chromium.googlesource.com/external/webrtc/+/ad34dbe934
This bug masked another issue with VP9 codec (see
crbug.com/webrtc/6723 ) and that increased number of dropped frames.
BUG=634816
Review-Url: https://codereview.webrtc.org/2512543002
Cr-Commit-Position: refs/heads/master@{#15143}
diff --git a/webrtc/video/payload_router.cc b/webrtc/video/payload_router.cc
index 2cc3e88..33d8f76 100644
--- a/webrtc/video/payload_router.cc
+++ b/webrtc/video/payload_router.cc
@@ -127,24 +127,21 @@
if (!active_)
return Result(Result::ERROR_SEND_FAILED);
- int stream_index = 0;
-
RTPVideoHeader rtp_video_header;
memset(&rtp_video_header, 0, sizeof(RTPVideoHeader));
if (codec_specific_info)
CopyCodecSpecific(codec_specific_info, &rtp_video_header);
rtp_video_header.rotation = encoded_image.rotation_;
rtp_video_header.playout_delay = encoded_image.playout_delay_;
- stream_index = rtp_video_header.simulcastIdx;
+ int stream_index = rtp_video_header.simulcastIdx;
+ RTC_DCHECK_LT(stream_index, rtp_modules_.size());
uint32_t frame_id;
- int send_result = rtp_modules_[stream_index]->SendOutgoingData(
+ bool send_result = rtp_modules_[stream_index]->SendOutgoingData(
encoded_image._frameType, payload_type_, encoded_image._timeStamp,
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)
+ if (!send_result)
return Result(Result::ERROR_SEND_FAILED);
return Result(Result::OK, frame_id);