Chromium Code Reviews| Index: webrtc/pc/mediasession.cc |
| diff --git a/webrtc/pc/mediasession.cc b/webrtc/pc/mediasession.cc |
| index f91a7297204541d7fcf24b82b053273e9dc614f6..e9a5a3f901560c6e0108842d1646dfbe81fcf3ee 100644 |
| --- a/webrtc/pc/mediasession.cc |
| +++ b/webrtc/pc/mediasession.cc |
| @@ -446,6 +446,9 @@ static bool AddStreamParams(MediaType media_type, |
| return true; |
| } |
| + const bool include_flexfec_stream = |
| + ContainsFlexfecCodec(content_description->codecs()); |
| + |
| MediaSessionOptions::Streams::const_iterator stream_it; |
| for (stream_it = streams.begin(); |
| stream_it != streams.end(); ++stream_it) { |
| @@ -481,6 +484,21 @@ static bool AddStreamParams(MediaType media_type, |
| } |
| content_description->set_multistream(true); |
| } |
| + // Generate extra ssrc for include_flexfec_stream case. |
| + if (include_flexfec_stream) { |
| + // TODO(brandtr): Update when we support multistream protection. |
|
perkj_webrtc
2016/11/17 20:41:12
No support for Simulcast?
brandtr
2016/11/21 09:16:30
No :( This is not too hard to add though, so it ma
|
| + if (ssrcs.size() == 1) { |
| + std::vector<uint32_t> flexfec_ssrcs; |
| + GenerateSsrcs(*current_streams, 1, &flexfec_ssrcs); |
| + stream_param.AddFecFrSsrc(ssrcs[0], flexfec_ssrcs[0]); |
| + content_description->set_multistream(true); |
| + } else if (!ssrcs.empty()) { |
| + LOG(LS_WARNING) |
| + << "Our FlexFEC implementation only supports protecting " |
| + << "a single media streams. This session has multiple " |
| + << "media streams however, so no FlexFEC SSRC will be generated."; |
| + } |
| + } |
| stream_param.cname = options.rtcp_cname; |
| stream_param.sync_label = stream_it->sync_label; |
| content_description->AddStream(stream_param); |
| @@ -686,6 +704,22 @@ static bool IsRtxCodec(const C& codec) { |
| return stricmp(codec.name.c_str(), kRtxCodecName) == 0; |
| } |
| +template <class C> |
| +static bool ContainsFlexfecCodec(const std::vector<C>& codecs) { |
| + typename std::vector<C>::const_iterator it; |
| + for (it = codecs.begin(); it != codecs.end(); ++it) { |
|
perkj_webrtc
2016/11/17 20:41:12
const auto& codec : codecs ?
brandtr
2016/11/21 09:16:30
Done.
|
| + if (IsFlexfecCodec(*it)) { |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| +template <class C> |
| +static bool IsFlexfecCodec(const C& codec) { |
| + return stricmp(codec.name.c_str(), kFlexfecCodecName) == 0; |
| +} |
| + |
| static TransportOptions GetTransportOptions(const MediaSessionOptions& options, |
| const std::string& content_name) { |
| TransportOptions transport_options; |