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

Unified Diff: webrtc/call/flexfec_receive_stream.cc

Issue 2499963002: Make configuration logic harsher in FlexfecReceiveStream. (Closed)
Patch Set: Feedback response 1. Created 4 years, 1 month 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/call/flexfec_receive_stream.h ('k') | webrtc/call/flexfec_receive_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/call/flexfec_receive_stream.cc
diff --git a/webrtc/call/flexfec_receive_stream.cc b/webrtc/call/flexfec_receive_stream.cc
index fb078f4e7bce1801a476c1ba3ce79084a2557b10..89da0087737776dd44c523e9b32c090d98d6e342 100644
--- a/webrtc/call/flexfec_receive_stream.cc
+++ b/webrtc/call/flexfec_receive_stream.cc
@@ -25,25 +25,38 @@ std::string FlexfecReceiveStream::Stats::ToString(int64_t time_ms) const {
namespace {
// TODO(brandtr): Update this function when we support multistream protection.
-std::unique_ptr<FlexfecReceiver> MaybeUpdateConfigAndCreateFlexfecReceiver(
- FlexfecReceiveStream::Config* config,
+std::unique_ptr<FlexfecReceiver> MaybeCreateFlexfecReceiver(
+ const FlexfecReceiveStream::Config& config,
RecoveredPacketReceiver* recovered_packet_callback) {
- if (config->protected_media_ssrcs.empty()) {
+ if (config.flexfec_payload_type < 0) {
+ LOG(LS_ERROR) << "Invalid FlexFEC payload type given. "
+ << "This FlexfecReceiveStream will therefore be useless.";
+ return nullptr;
+ }
+ RTC_DCHECK_GE(config.flexfec_payload_type, 0);
+ RTC_DCHECK_LE(config.flexfec_payload_type, 127);
+ if (config.flexfec_ssrc == 0) {
+ LOG(LS_ERROR) << "Invalid FlexFEC SSRC given. "
+ << "This FlexfecReceiveStream will therefore be useless.";
+ return nullptr;
+ }
+ if (config.protected_media_ssrcs.empty()) {
LOG(LS_ERROR) << "No protected media SSRC supplied. "
<< "This FlexfecReceiveStream will therefore be useless.";
return nullptr;
- } else if (config->protected_media_ssrcs.size() > 1) {
+ }
+
+ if (config.protected_media_ssrcs.size() > 1) {
LOG(LS_WARNING)
terelius 2016/11/15 10:01:58 Should this be LS_ERROR?
brandtr 2016/11/15 10:28:14 Changed all to be WARNINGs, as per offline discuss
<< "The supplied FlexfecConfig contained multiple protected "
"media streams, but our implementation currently only "
- "supports protecting a single media stream. This "
- "FlexfecReceiveStream will therefore only accept media "
- "packets from the first supplied media stream, with SSRC "
- << config->protected_media_ssrcs[0] << ".";
- config->protected_media_ssrcs.resize(1);
+ "supports protecting a single media stream. "
+ "To avoid confusion, disabling FlexFEC completely.";
+ return nullptr;
}
+ RTC_DCHECK_EQ(1U, config.protected_media_ssrcs.size());
return std::unique_ptr<FlexfecReceiver>(new FlexfecReceiver(
- config->flexfec_ssrc, config->protected_media_ssrcs[0],
+ config.flexfec_ssrc, config.protected_media_ssrcs[0],
recovered_packet_callback));
}
@@ -56,8 +69,8 @@ FlexfecReceiveStream::FlexfecReceiveStream(
RecoveredPacketReceiver* recovered_packet_callback)
: started_(false),
config_(configuration),
- receiver_(MaybeUpdateConfigAndCreateFlexfecReceiver(
- &config_,
+ receiver_(MaybeCreateFlexfecReceiver(
+ config_,
recovered_packet_callback)) {
LOG(LS_INFO) << "FlexfecReceiveStream: " << config_.ToString();
}
« no previous file with comments | « webrtc/call/flexfec_receive_stream.h ('k') | webrtc/call/flexfec_receive_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698