Chromium Code Reviews| Index: remoting/protocol/webrtc_transport.cc |
| diff --git a/remoting/protocol/webrtc_transport.cc b/remoting/protocol/webrtc_transport.cc |
| index 9a6d243fe6acd8439b74053871752c51f7149253..a99d7f07ce0cf367dfef6f09b88526cc47008d56 100644 |
| --- a/remoting/protocol/webrtc_transport.cc |
| +++ b/remoting/protocol/webrtc_transport.cc |
| @@ -4,6 +4,7 @@ |
| #include "remoting/protocol/webrtc_transport.h" |
| +#include <string> |
| #include <utility> |
| #include "base/base64.h" |
| @@ -15,11 +16,13 @@ |
| #include "base/task_runner_util.h" |
| #include "base/thread_task_runner_handle.h" |
| #include "jingle/glue/thread_wrapper.h" |
| +#include "remoting/codec/webrtc_video_encoder.h" |
| #include "remoting/protocol/authenticator.h" |
| #include "remoting/protocol/port_allocator_factory.h" |
| #include "remoting/protocol/stream_message_pipe_adapter.h" |
| #include "remoting/protocol/transport_context.h" |
| #include "third_party/webrtc/api/test/fakeconstraints.h" |
| +#include "third_party/webrtc/base/stringutils.h" |
| #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" |
| #include "third_party/webrtc/modules/audio_device/include/fake_audio_device.h" |
| @@ -102,7 +105,7 @@ class SetSessionDescriptionObserver |
| } |
| protected: |
| - SetSessionDescriptionObserver(const ResultCallback& result_callback) |
| + explicit SetSessionDescriptionObserver(const ResultCallback& result_callback) |
| : result_callback_(result_callback) {} |
| ~SetSessionDescriptionObserver() override {} |
| @@ -153,10 +156,12 @@ void WebrtcTransport::Start( |
| } |
| fake_audio_device_module_.reset(new webrtc::FakeAudioDeviceModule()); |
| + video_encoder_factory_ = new remoting::WebRtcVideoEncoderFactory(); |
| + // Takes ownership of video_encoder_factory_ |
| peer_connection_factory_ = webrtc::CreatePeerConnectionFactory( |
| - worker_thread_, rtc::Thread::Current(), |
| - fake_audio_device_module_.get(), nullptr, nullptr); |
| + worker_thread_, rtc::Thread::Current(), fake_audio_device_module_.get(), |
| + video_encoder_factory_, nullptr); |
| webrtc::PeerConnectionInterface::IceServer stun_server; |
| stun_server.urls.push_back("stun:stun.l.google.com:19302"); |
| @@ -229,6 +234,17 @@ bool WebrtcTransport::ProcessTransportInfo(XmlElement* transport_info) { |
| } |
| } |
| + // TODO(isheriff): The need for this should go away once we have a proper |
| + // API to provide max bitrate for the case of handing over encoded |
| + // frames to webrtc. |
| + // Increase max bitrate from 600 kbps to 5 Mbps. |
| + std::string vp8line = "a=rtpmap:100 VP8/90000\n"; |
|
Sergey Ulanov
2016/03/31 22:06:19
I think webrtc generates SDP with '\r\n' at the en
Irfan
2016/04/05 21:23:28
It was working for me.
|
| + std::string vp8line_with_bitrate = |
| + vp8line + "a=fmtp:100 x-google-max-bitrate=5000\n"; |
| + rtc::replace_substrs(vp8line.c_str(), vp8line.length(), |
|
Sergey Ulanov
2016/03/31 22:06:19
Please use base::ReplaceSubstringsAfterOffset:
ba
Irfan
2016/04/05 21:23:28
Done.
|
| + vp8line_with_bitrate.c_str(), |
| + vp8line_with_bitrate.length(), &sdp); |
| + |
| webrtc::SdpParseError error; |
| scoped_ptr<webrtc::SessionDescriptionInterface> session_description( |
| webrtc::CreateSessionDescription(type, sdp, &error)); |