Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc

Issue 3000713002: Add audio_level member to RtpSource and set it from RtpReceiverImpl::IncomingRtpPacket. (Closed)
Patch Set: Move audio level update to critical section protected method and address other feedback. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
index 20f57460a68ffc1cb30d84b43e46dd2361400c7f..5693fd1d69cd086787b8b62c2a6b4c9bbfd01b4d 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.cc
@@ -163,7 +163,11 @@ bool RtpReceiverImpl::IncomingRtpPacket(
webrtc_rtp_header.header = rtp_header;
CheckCSRC(webrtc_rtp_header);
- UpdateSources();
+ auto audio_level =
+ rtp_header.extension.hasAudioLevel
+ ? rtc::Optional<uint8_t>(rtp_header.extension.audioLevel)
+ : rtc::Optional<uint8_t>();
+ UpdateSources(audio_level);
size_t payload_data_length = payload_length - rtp_header.paddingLength;
@@ -500,7 +504,7 @@ void RtpReceiverImpl::CheckCSRC(const WebRtcRTPHeader& rtp_header) {
}
}
-void RtpReceiverImpl::UpdateSources() {
+void RtpReceiverImpl::UpdateSources(rtc::Optional<uint8_t> audio_level) {
rtc::CritScope lock(&critical_section_rtp_receiver_);
int64_t now_ms = clock_->TimeInMilliseconds();
@@ -528,6 +532,8 @@ void RtpReceiverImpl::UpdateSources() {
}
RemoveOutdatedSources(now_ms);
+
+ ssrc_sources_.back().set_audio_level(audio_level);
danilchap 2017/08/16 10:31:40 this line probably looks better before RemoveOutda
Zach Stein 2017/08/21 17:55:06 Done.
}
void RtpReceiverImpl::RemoveOutdatedSources(int64_t now_ms) {
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_receiver_impl.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_receiver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698