Add payload_name and payload_type to VideoSendStream::Config::Rtp.

Another step of the transition needed to reland cl
https://webrtc-review.googlesource.com/62062, and move payload_name
and payload_type out of VideoSendStream::Config::EncoderSettings.

If the new fields are set, values of the old fields are ignored.

Bug: webrtc:8830
Change-Id: I1f0cd56fd6b13b05608b284afc92523707887e25
Reviewed-on: https://webrtc-review.googlesource.com/64101
Reviewed-by: Erik Språng <sprang@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22562}
diff --git a/call/video_send_stream.h b/call/video_send_stream.h
index 440b62e..9be604a 100644
--- a/call/video_send_stream.h
+++ b/call/video_send_stream.h
@@ -120,6 +120,8 @@
             encoder(encoder) {}
       std::string ToString() const;
 
+      // TODO(nisse): About to be deleted. Unused if the corresponding
+      // fields in the below Rtp struct are set.
       std::string payload_name;
       int payload_type = -1;
 
@@ -159,6 +161,16 @@
       // RTP header extensions to use for this send stream.
       std::vector<RtpExtension> extensions;
 
+      // TODO(nisse): For now, these are fixed, but we'd like to support
+      // changing codec without recreating the VideoSendStream. Then these
+      // fields must be removed, and association between payload type and codec
+      // must move above the per-stream level. Ownership could be with
+      // RtpTransportControllerSend, with a reference from PayloadRouter, where
+      // the latter would be responsible for mapping the codec type of encoded
+      // images to the right payload type.
+      std::string payload_name;
+      int payload_type = -1;
+
       // See NackConfig for description.
       NackConfig nack;
 
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index a51a5ae..1a50c5e 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -731,7 +731,9 @@
                                              transport->keepalive_config())),
       payload_router_(rtp_rtcp_modules_,
                       config_->rtp.ssrcs,
-                      config_->encoder_settings.payload_type,
+                      config_->rtp.payload_type != -1
+                          ? config_->rtp.payload_type
+                          : config_->encoder_settings.payload_type,
                       suspended_payload_states),
       weak_ptr_factory_(this),
       overhead_bytes_per_packet_(0),
@@ -828,8 +830,12 @@
     rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(stats_proxy_);
     rtp_rtcp->SetMaxRtpPacketSize(config_->rtp.max_packet_size);
     rtp_rtcp->RegisterVideoSendPayload(
-        config_->encoder_settings.payload_type,
-        config_->encoder_settings.payload_name.c_str());
+        config_->rtp.payload_type != -1
+            ? config_->rtp.payload_type
+            : config_->encoder_settings.payload_type,
+        !config_->rtp.payload_name.empty()
+            ? config_->rtp.payload_name.c_str()
+            : config_->encoder_settings.payload_name.c_str());
   }
 
   fec_controller_->SetProtectionCallback(this);