Chromium Code Reviews| 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..b357249655484329907a0273cfb04d1086b8321d 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 == -1) { |
|
stefan-webrtc
2016/11/14 15:21:50
< 0?
brandtr
2016/11/15 09:18:59
Yes, that stricter check makes sense.
|
| + 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) |
| << "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(); |
| } |