[Unified Plan] If "a=msid" is missing, create default stream.

Prior to this CL, if the "a=msid" attribute was missing it was treated
the same as if "no streams" were explicitly signaled (a=msid:-); the
receivers would not be associated with any streams.

In order to support legacy endpoints that don't recognize "a=msid" that
assume the Plan B behavior of a stream being created anyway, this CL
creates a stream with a random ID in such cases. For background, see
https://github.com/web-platform-tests/wpt/pull/14054.

Bug: chromium:907508
Change-Id: I9d9dd0e4ba8f9941f8652f4d7873adc560777cd9
Reviewed-on: https://webrtc-review.googlesource.com/c/112900
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25901}
diff --git a/pc/peerconnection.cc b/pc/peerconnection.cc
index c817494..4a5bd92 100644
--- a/pc/peerconnection.cc
+++ b/pc/peerconnection.cc
@@ -2468,6 +2468,18 @@
           }
           media_streams.push_back(stream);
         }
+        // Special case: "a=msid" missing, use random stream ID.
+        if (media_streams.empty() &&
+            !(remote_description()->description()->msid_signaling() &
+              cricket::kMsidSignalingMediaSection)) {
+          if (!missing_msid_default_stream_) {
+            missing_msid_default_stream_ = MediaStreamProxy::Create(
+                rtc::Thread::Current(),
+                MediaStream::Create(rtc::CreateRandomUuid()));
+            added_streams.push_back(missing_msid_default_stream_);
+          }
+          media_streams.push_back(missing_msid_default_stream_);
+        }
         // This will add the remote track to the streams.
         // TODO(hbos): When we remove remote_streams(), use set_stream_ids()
         // instead. https://crbug.com/webrtc/9480