Use the SDP ContentInfo helpers to avoid downcasting

This changes all internal code to use the media_description() helper
for ContentInfo along with the as_audio, as_video, and as_data casting
methods introduced in a previous CL. Reduces the total number of
pointer static_casts in pc/ from 351 to 122.

Bug: webrtc:8620
Change-Id: I996f49b55f1501c758a9e5223e30539a9f8d4eac
Reviewed-on: https://webrtc-review.googlesource.com/35921
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21419}
diff --git a/pc/peerconnection_integrationtest.cc b/pc/peerconnection_integrationtest.cc
index 6ae4a92..abad10f 100644
--- a/pc/peerconnection_integrationtest.cc
+++ b/pc/peerconnection_integrationtest.cc
@@ -118,9 +118,7 @@
 // attribute from received SDP, simulating a legacy endpoint.
 void RemoveSsrcsAndMsids(cricket::SessionDescription* desc) {
   for (ContentInfo& content : desc->contents()) {
-    MediaContentDescription* media_desc =
-        static_cast<MediaContentDescription*>(content.description);
-    media_desc->mutable_streams().clear();
+    content.media_description()->mutable_streams().clear();
   }
   desc->set_msid_supported(false);
 }
@@ -2110,9 +2108,8 @@
 // Helper for test below.
 void ModifySsrcs(cricket::SessionDescription* desc) {
   for (ContentInfo& content : desc->contents()) {
-    MediaContentDescription* media_desc =
-        static_cast<MediaContentDescription*>(content.description);
-    for (cricket::StreamParams& stream : media_desc->mutable_streams()) {
+    for (cricket::StreamParams& stream :
+         content.media_description()->mutable_streams()) {
       for (uint32_t& ssrc : stream.ssrcs) {
         ssrc = rtc::CreateRandomId();
       }
@@ -2735,10 +2732,9 @@
 }
 
 static void MakeSpecCompliantSctpOffer(cricket::SessionDescription* desc) {
-  const ContentInfo* dc_offer = GetFirstDataContent(desc);
-  ASSERT_NE(nullptr, dc_offer);
   cricket::DataContentDescription* dcd_offer =
-      static_cast<cricket::DataContentDescription*>(dc_offer->description);
+      GetFirstDataContentDescription(desc);
+  ASSERT_TRUE(dcd_offer);
   dcd_offer->set_use_sctpmap(false);
   dcd_offer->set_protocol("UDP/DTLS/SCTP");
 }