Chromium Code Reviews| Index: webrtc/video_engine/vie_channel_group.cc |
| diff --git a/webrtc/video_engine/vie_channel_group.cc b/webrtc/video_engine/vie_channel_group.cc |
| index cb041bda2e250ae73c72ca822feff7848bdb4b22..f7132b7659781c82c929480f01eb43dfc37c8dd2 100644 |
| --- a/webrtc/video_engine/vie_channel_group.cc |
| +++ b/webrtc/video_engine/vie_channel_group.cc |
| @@ -16,6 +16,7 @@ |
| #include "webrtc/experiments.h" |
| #include "webrtc/modules/pacing/include/paced_sender.h" |
| #include "webrtc/modules/pacing/include/packet_router.h" |
| +#include "webrtc/modules/remote_bitrate_estimator/include/send_time_history.h" |
| #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.h" |
| #include "webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_single_stream.h" |
| #include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h" |
| @@ -139,8 +140,42 @@ class WrappingBitrateEstimator : public RemoteBitrateEstimator { |
| DISALLOW_IMPLICIT_CONSTRUCTORS(WrappingBitrateEstimator); |
| }; |
| + |
| +static const int64_t kSendTimeHistoryWindowMs = 2000; |
| + |
| } // namespace |
| +class AdaptedSendTimeHistory : public SendTimeHistory, public SendTimeObserver { |
| + public: |
| + AdaptedSendTimeHistory() : SendTimeHistory(kSendTimeHistoryWindowMs) {} |
| + virtual ~AdaptedSendTimeHistory() {} |
| + |
| + void OnPacketSent(uint16_t sequence_number, int64_t send_time) override { |
| + SendTimeHistory::AddAndRemoveOldSendTimes(sequence_number, send_time); |
| + } |
| + |
| + // Populate PacketInfo.send_time_ms, by looking up the send time in the |
| + // stored history index by sequence number. Returns the number of PacketInfo |
| + // instances for which the lookup was successful. |
| + size_t PopulateSendTimes(std::vector<PacketInfo>* packet_info) { |
| + return 0; |
| + /* |
| + * rtc::CritScope cs(&history_lock_); |
| + if (!send_time_history_.get()) |
| + return 0; |
| + |
| + size_t successful_lookups = 0; |
| + for (PacketInfo& info : *packet_info) { |
| + if (send_time_history_->GetSendTime(info.sequence_number, |
| + &info.send_time_ms, true)) { |
| + ++successful_lookups; |
| + } |
| + } |
| + return successful_lookups; |
| + */ |
|
stefan-webrtc
2015/07/29 09:04:11
Probably want to remove this comment? :)
sprang_webrtc
2015/07/29 10:03:25
Yes, even the whole method. Moved to a different C
|
| + } |
| +}; |
| + |
| ChannelGroup::ChannelGroup(ProcessThread* process_thread) |
| : remb_(new VieRemb()), |
| bitrate_allocator_(new BitrateAllocator()), |
| @@ -161,7 +196,8 @@ ChannelGroup::ChannelGroup(ProcessThread* process_thread) |
| // construction. |
| bitrate_controller_( |
| BitrateController::CreateBitrateController(Clock::GetRealTimeClock(), |
| - this)) { |
| + this)), |
| + send_time_history_(new AdaptedSendTimeHistory()) { |
| remote_bitrate_estimator_.reset(new WrappingBitrateEstimator( |
| remb_.get(), Clock::GetRealTimeClock(), *config_.get())); |
| @@ -249,9 +285,9 @@ bool ChannelGroup::CreateChannel(int channel_id, |
| channel_id, engine_id, number_of_cores, *config_.get(), transport, |
| process_thread_, encoder_state_feedback_->GetRtcpIntraFrameObserver(), |
| bitrate_controller_->CreateRtcpBandwidthObserver(), |
| - remote_bitrate_estimator_.get(), call_stats_->rtcp_rtt_stats(), |
| - pacer_.get(), packet_router_.get(), max_rtp_streams, sender, |
| - disable_default_encoder)); |
| + send_time_history_.get(), remote_bitrate_estimator_.get(), |
| + call_stats_->rtcp_rtt_stats(), pacer_.get(), packet_router_.get(), |
| + max_rtp_streams, sender, disable_default_encoder)); |
| if (channel->Init() != 0) { |
| return false; |
| } |