 Chromium Code Reviews
 Chromium Code Reviews Issue 2838233002:
  Add PeerConnectionInterface::UpdateCallBitrate with call tests.  (Closed)
    
  
    Issue 2838233002:
  Add PeerConnectionInterface::UpdateCallBitrate with call tests.  (Closed) 
  | OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 
| 3 * | 3 * | 
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license | 
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source | 
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found | 
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may | 
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. | 
| 9 */ | 9 */ | 
| 10 #ifndef WEBRTC_CALL_CALL_H_ | 10 #ifndef WEBRTC_CALL_CALL_H_ | 
| 11 #define WEBRTC_CALL_CALL_H_ | 11 #define WEBRTC_CALL_CALL_H_ | 
| 12 | 12 | 
| 13 #include <memory> | |
| 13 #include <string> | 14 #include <string> | 
| 14 #include <vector> | 15 #include <vector> | 
| 15 | 16 | 
| 17 #include "webrtc/api/rtcerror.h" | |
| 16 #include "webrtc/base/networkroute.h" | 18 #include "webrtc/base/networkroute.h" | 
| 17 #include "webrtc/base/platform_file.h" | 19 #include "webrtc/base/platform_file.h" | 
| 18 #include "webrtc/base/socket.h" | 20 #include "webrtc/base/socket.h" | 
| 19 #include "webrtc/call/audio_receive_stream.h" | 21 #include "webrtc/call/audio_receive_stream.h" | 
| 20 #include "webrtc/call/audio_send_stream.h" | 22 #include "webrtc/call/audio_send_stream.h" | 
| 21 #include "webrtc/call/audio_state.h" | 23 #include "webrtc/call/audio_state.h" | 
| 22 #include "webrtc/call/flexfec_receive_stream.h" | 24 #include "webrtc/call/flexfec_receive_stream.h" | 
| 25 #include "webrtc/call/rtp_transport_controller_send.h" | |
| 23 #include "webrtc/common_types.h" | 26 #include "webrtc/common_types.h" | 
| 24 #include "webrtc/video_receive_stream.h" | 27 #include "webrtc/video_receive_stream.h" | 
| 25 #include "webrtc/video_send_stream.h" | 28 #include "webrtc/video_send_stream.h" | 
| 26 | 29 | 
| 27 namespace webrtc { | 30 namespace webrtc { | 
| 28 | 31 | 
| 29 class AudioProcessing; | 32 class AudioProcessing; | 
| 30 class RtcEventLog; | 33 class RtcEventLog; | 
| 31 | 34 | 
| 32 const char* Version(); | 35 const char* Version(); | 
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 static const int kDefaultStartBitrateBps; | 71 static const int kDefaultStartBitrateBps; | 
| 69 | 72 | 
| 70 // Bitrate config used until valid bitrate estimates are calculated. Also | 73 // Bitrate config used until valid bitrate estimates are calculated. Also | 
| 71 // used to cap total bitrate used. | 74 // used to cap total bitrate used. | 
| 72 struct BitrateConfig { | 75 struct BitrateConfig { | 
| 73 int min_bitrate_bps = 0; | 76 int min_bitrate_bps = 0; | 
| 74 int start_bitrate_bps = kDefaultStartBitrateBps; | 77 int start_bitrate_bps = kDefaultStartBitrateBps; | 
| 75 int max_bitrate_bps = -1; | 78 int max_bitrate_bps = -1; | 
| 76 } bitrate_config; | 79 } bitrate_config; | 
| 77 | 80 | 
| 81 // TODO(zstein): Consider using PeerConnectionInterface::BitrateParameters | |
| 82 // instead (and move BitrateParameters to its own file in api/). | |
| 83 struct BitrateConfigMask { | |
| 84 rtc::Optional<int> min_bitrate_bps; | |
| 85 rtc::Optional<int> start_bitrate_bps; | |
| 86 rtc::Optional<int> max_bitrate_bps; | |
| 87 }; | |
| 88 | |
| 78 // AudioState which is possibly shared between multiple calls. | 89 // AudioState which is possibly shared between multiple calls. | 
| 79 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 90 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 
| 80 rtc::scoped_refptr<AudioState> audio_state; | 91 rtc::scoped_refptr<AudioState> audio_state; | 
| 81 | 92 | 
| 82 // Audio Processing Module to be used in this call. | 93 // Audio Processing Module to be used in this call. | 
| 83 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 94 // TODO(solenberg): Change this to a shared_ptr once we can use C++11. | 
| 84 AudioProcessing* audio_processing = nullptr; | 95 AudioProcessing* audio_processing = nullptr; | 
| 85 | 96 | 
| 86 // RtcEventLog to use for this call. Required. | 97 // RtcEventLog to use for this call. Required. | 
| 87 // Use webrtc::RtcEventLog::CreateNull() for a null implementation. | 98 // Use webrtc::RtcEventLog::CreateNull() for a null implementation. | 
| 88 RtcEventLog* event_log = nullptr; | 99 RtcEventLog* event_log = nullptr; | 
| 89 }; | 100 }; | 
| 90 | 101 | 
| 91 struct Stats { | 102 struct Stats { | 
| 92 std::string ToString(int64_t time_ms) const; | 103 std::string ToString(int64_t time_ms) const; | 
| 93 | 104 | 
| 94 int send_bandwidth_bps = 0; // Estimated available send bandwidth. | 105 int send_bandwidth_bps = 0; // Estimated available send bandwidth. | 
| 95 int max_padding_bitrate_bps = 0; // Cumulative configured max padding. | 106 int max_padding_bitrate_bps = 0; // Cumulative configured max padding. | 
| 96 int recv_bandwidth_bps = 0; // Estimated available receive bandwidth. | 107 int recv_bandwidth_bps = 0; // Estimated available receive bandwidth. | 
| 97 int64_t pacer_delay_ms = 0; | 108 int64_t pacer_delay_ms = 0; | 
| 98 int64_t rtt_ms = -1; | 109 int64_t rtt_ms = -1; | 
| 99 }; | 110 }; | 
| 100 | 111 | 
| 101 static Call* Create(const Call::Config& config); | 112 static Call* Create(const Call::Config& config); | 
| 102 | 113 | 
| 114 static Call* Create( | |
| 
Taylor_Brandstetter
2017/04/26 15:46:11
Could you add a comment that this Create method is
 
Zach Stein
2017/05/04 22:32:43
Done.
 | |
| 115 const Call::Config& config, | |
| 116 std::unique_ptr<RtpTransportControllerSendInterface> transport_send); | |
| 117 | |
| 103 virtual AudioSendStream* CreateAudioSendStream( | 118 virtual AudioSendStream* CreateAudioSendStream( | 
| 104 const AudioSendStream::Config& config) = 0; | 119 const AudioSendStream::Config& config) = 0; | 
| 105 virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0; | 120 virtual void DestroyAudioSendStream(AudioSendStream* send_stream) = 0; | 
| 106 | 121 | 
| 107 virtual AudioReceiveStream* CreateAudioReceiveStream( | 122 virtual AudioReceiveStream* CreateAudioReceiveStream( | 
| 108 const AudioReceiveStream::Config& config) = 0; | 123 const AudioReceiveStream::Config& config) = 0; | 
| 109 virtual void DestroyAudioReceiveStream( | 124 virtual void DestroyAudioReceiveStream( | 
| 110 AudioReceiveStream* receive_stream) = 0; | 125 AudioReceiveStream* receive_stream) = 0; | 
| 111 | 126 | 
| 112 virtual VideoSendStream* CreateVideoSendStream( | 127 virtual VideoSendStream* CreateVideoSendStream( | 
| (...skipping 16 matching lines...) Expand all Loading... | |
| 129 | 144 | 
| 130 // All received RTP and RTCP packets for the call should be inserted to this | 145 // All received RTP and RTCP packets for the call should be inserted to this | 
| 131 // PacketReceiver. The PacketReceiver pointer is valid as long as the | 146 // PacketReceiver. The PacketReceiver pointer is valid as long as the | 
| 132 // Call instance exists. | 147 // Call instance exists. | 
| 133 virtual PacketReceiver* Receiver() = 0; | 148 virtual PacketReceiver* Receiver() = 0; | 
| 134 | 149 | 
| 135 // Returns the call statistics, such as estimated send and receive bandwidth, | 150 // Returns the call statistics, such as estimated send and receive bandwidth, | 
| 136 // pacing delay, etc. | 151 // pacing delay, etc. | 
| 137 virtual Stats GetStats() const = 0; | 152 virtual Stats GetStats() const = 0; | 
| 138 | 153 | 
| 139 // TODO(pbos): Like BitrateConfig above this is currently per-stream instead | 154 // The min and start values will only be used if they are not set by | 
| 140 // of maximum for entire Call. This should be fixed along with the above. | 155 // SetBitrateConfigMask. The minimum max set by the two calls will be used. | 
| 141 // Specifying a start bitrate (>0) will currently reset the current bitrate | 156 // Specifying a start bitrate (>0) will reset the current bitrate estimate. | 
| 142 // estimate. This is due to how the 'x-google-start-bitrate' flag is currently | 157 // This is due to how the 'x-google-start-bitrate' flag is currently | 
| 143 // implemented. | 158 // implemented. | 
| 144 virtual void SetBitrateConfig( | 159 virtual void SetBitrateConfig( | 
| 145 const Config::BitrateConfig& bitrate_config) = 0; | 160 const Config::BitrateConfig& bitrate_config) = 0; | 
| 146 | 161 | 
| 162 // The min and start values set here are preferred to values set by | |
| 163 // SetBitrateConfig. The minimum of the max set by the two calls will be used. | |
| 164 // Assumes 0 <= min <= start <= max holds for set parameters. | |
| 165 virtual RTCError SetBitrateConfigMask( | |
| 166 const Config::BitrateConfigMask& bitrate_mask) = 0; | |
| 167 | |
| 147 // TODO(skvlad): When the unbundled case with multiple streams for the same | 168 // TODO(skvlad): When the unbundled case with multiple streams for the same | 
| 148 // media type going over different networks is supported, track the state | 169 // media type going over different networks is supported, track the state | 
| 149 // for each stream separately. Right now it's global per media type. | 170 // for each stream separately. Right now it's global per media type. | 
| 150 virtual void SignalChannelNetworkState(MediaType media, | 171 virtual void SignalChannelNetworkState(MediaType media, | 
| 151 NetworkState state) = 0; | 172 NetworkState state) = 0; | 
| 152 | 173 | 
| 153 virtual void OnTransportOverheadChanged( | 174 virtual void OnTransportOverheadChanged( | 
| 154 MediaType media, | 175 MediaType media, | 
| 155 int transport_overhead_per_packet) = 0; | 176 int transport_overhead_per_packet) = 0; | 
| 156 | 177 | 
| 157 virtual void OnNetworkRouteChanged( | 178 virtual void OnNetworkRouteChanged( | 
| 158 const std::string& transport_name, | 179 const std::string& transport_name, | 
| 159 const rtc::NetworkRoute& network_route) = 0; | 180 const rtc::NetworkRoute& network_route) = 0; | 
| 160 | 181 | 
| 161 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; | 182 virtual void OnSentPacket(const rtc::SentPacket& sent_packet) = 0; | 
| 162 | 183 | 
| 163 virtual ~Call() {} | 184 virtual ~Call() {} | 
| 164 }; | 185 }; | 
| 165 | 186 | 
| 166 } // namespace webrtc | 187 } // namespace webrtc | 
| 167 | 188 | 
| 168 #endif // WEBRTC_CALL_CALL_H_ | 189 #endif // WEBRTC_CALL_CALL_H_ | 
| OLD | NEW |