Callback for send bitrate estimates - new roll
Issue https://webrtc-codereview.appspot.com/4459004/ was commited as
r5259, after which flakiness was detected and a rollback was performed
at r5261.
Patch Set 1 of this issue is the code submitted in r5259. Subsequent
patch sets fixes a race condition which caused the seen problems.
The root cause was a dead lock between a thread sending rtp packets and
and a timed module processing thread:
webrtc::RTPSender::BitrateUpdated() // Get RTPSender stats lock
webrtc::Bitrate::Process() // Get Bitrate lock
webrtc::RTPSender::ProcessBitrate()
webrtc::ModuleRtpRtcpImpl::Process()
...
webrtc::Bitrate::Update() // Get Bitrate lock
webrtc::RTPSender::UpdateRtpStats() // Get RTPSender stats lock
webrtc::RTPSender::SendToNetwork()
...
This is fixed in Bitrate::Process() by releasing the lock before
calling the callback.
BUG=2235
R=mflodman@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/5619004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@5281 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/common_types.h b/common_types.h
index 82f45d8..30231ce 100644
--- a/common_types.h
+++ b/common_types.h
@@ -285,14 +285,11 @@
// Rate statistics for a stream
struct BitrateStatistics {
- BitrateStatistics()
- : bitrate_(0),
- packet_rate(0),
- now(0) {}
+ BitrateStatistics() : bitrate_bps(0), packet_rate(0), timestamp_ms(0) {}
- uint32_t bitrate_;
- uint32_t packet_rate;
- uint64_t now;
+ uint32_t bitrate_bps; // Bitrate in bits per second.
+ uint32_t packet_rate; // Packet rate in packets per second.
+ uint64_t timestamp_ms; // Ntp timestamp in ms at time of rate estimation.
};
// Callback, used to notify an observer whenever new rates have been estimated.