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

Unified Diff: webrtc/pc/mediasession.cc

Issue 2505003003: Let MediaSession generate a FlexFEC SSRC when FlexFEC is active. (Closed)
Patch Set: Rebase. 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 | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | webrtc/pc/mediasession_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | webrtc/pc/mediasession_unittest.cc » ('j') | webrtc/pc/mediasession_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698