| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/webrtc_transport.h" | 5 #include "remoting/protocol/webrtc_transport.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // - Setting min bitrate here enables padding. | 64 // - Setting min bitrate here enables padding. |
| 65 // - The default max bitrate is 600 kbps. Setting it to 100 Mbps allows to | 65 // - The default max bitrate is 600 kbps. Setting it to 100 Mbps allows to |
| 66 // use higher bandwidth when it's available. | 66 // use higher bandwidth when it's available. |
| 67 // | 67 // |
| 68 // TODO(sergeyu): Padding needs to be enabled to workaround BW estimator not | 68 // TODO(sergeyu): Padding needs to be enabled to workaround BW estimator not |
| 69 // handling spiky traffic patterns well. This won't be necessary with a | 69 // handling spiky traffic patterns well. This won't be necessary with a |
| 70 // better bandwidth estimator. | 70 // better bandwidth estimator. |
| 71 // TODO(isheriff): The need for this should go away once we have a proper | 71 // TODO(isheriff): The need for this should go away once we have a proper |
| 72 // API to provide max bitrate for the case of handing over encoded | 72 // API to provide max bitrate for the case of handing over encoded |
| 73 // frames to webrtc. | 73 // frames to webrtc. |
| 74 if (sdp_message->has_video() && | 74 if (sdp_message->has_video()) { |
| 75 !sdp_message->AddCodecParameter( | 75 bool param_added = sdp_message->AddCodecParameter( |
| 76 "VP8", "x-google-min-bitrate=1000; x-google-max-bitrate=100000")) { | 76 "VP8", "x-google-min-bitrate=1000; x-google-max-bitrate=100000"); |
| 77 if (incoming) { | 77 param_added |= sdp_message->AddCodecParameter( |
| 78 LOG(WARNING) << "VP8 not found in an incoming SDP."; | 78 "VP9", "x-google-min-bitrate=1000; x-google-max-bitrate=100000"); |
| 79 } else { | 79 if (!param_added) { |
| 80 LOG(FATAL) << "VP8 not found in SDP generated by WebRTC."; | 80 if (incoming) { |
| 81 LOG(WARNING) << "Neither of VP8/VP9 is found in an incoming SDP."; |
| 82 } else { |
| 83 LOG(FATAL) << "Neither of VP8/VP9 is found in SDP generated by WebRTC."; |
| 84 } |
| 81 } | 85 } |
| 82 } | 86 } |
| 83 | 87 |
| 84 // Update SDP format to use 160kbps stereo for opus codec. | 88 // Update SDP format to use 160kbps stereo for opus codec. |
| 85 if (sdp_message->has_audio() && | 89 if (sdp_message->has_audio() && |
| 86 !sdp_message->AddCodecParameter("opus", | 90 !sdp_message->AddCodecParameter("opus", |
| 87 "stereo=1; maxaveragebitrate=163840")) { | 91 "stereo=1; maxaveragebitrate=163840")) { |
| 88 if (incoming) { | 92 if (incoming) { |
| 89 LOG(WARNING) << "Opus not found in an incoming SDP."; | 93 LOG(WARNING) << "Opus not found in an incoming SDP."; |
| 90 } else { | 94 } else { |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 // the stack and so it must be destroyed later. | 718 // the stack and so it must be destroyed later. |
| 715 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( | 719 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( |
| 716 FROM_HERE, peer_connection_wrapper_.release()); | 720 FROM_HERE, peer_connection_wrapper_.release()); |
| 717 | 721 |
| 718 if (error != OK) | 722 if (error != OK) |
| 719 event_handler_->OnWebrtcTransportError(error); | 723 event_handler_->OnWebrtcTransportError(error); |
| 720 } | 724 } |
| 721 | 725 |
| 722 } // namespace protocol | 726 } // namespace protocol |
| 723 } // namespace remoting | 727 } // namespace remoting |
| OLD | NEW |