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

Unified Diff: webrtc/voice_engine/channel.cc

Issue 1236023010: In PeerConnectionTestWrapper, put audio input on a separate thread. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Use "nullptr" instead of "NULL" Created 5 years, 5 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
« webrtc/voice_engine/channel.h ('K') | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/voice_engine/channel.cc
diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc
index 8992425b537b0e32d329a470d58fe50d2619171d..164b99fd60a63b3733f9687af9c4d23d2ea011d8 100644
--- a/webrtc/voice_engine/channel.cc
+++ b/webrtc/voice_engine/channel.cc
@@ -717,6 +717,7 @@ Channel::Channel(int32_t channelId,
_fileCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
_callbackCritSect(*CriticalSectionWrapper::CreateCriticalSection()),
volume_settings_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
+ video_sync_critsect_(*CriticalSectionWrapper::CreateCriticalSection()),
_instanceId(instanceId),
_channelId(channelId),
rtp_header_parser_(RtpHeaderParser::Create()),
@@ -899,6 +900,7 @@ Channel::~Channel()
delete &_callbackCritSect;
delete &_fileCritSect;
delete &volume_settings_critsect_;
+ delete &video_sync_critsect_;
}
int32_t
@@ -3561,6 +3563,7 @@ void Channel::GetDecodingCallStatistics(AudioDecodingCallStats* stats) const {
bool Channel::GetDelayEstimate(int* jitter_buffer_delay_ms,
int* playout_buffer_delay_ms) const {
+ CriticalSectionScoped cs(&video_sync_critsect_);
if (_average_jitter_buffer_delay_us == 0) {
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::GetDelayEstimate() no valid estimate.");
@@ -3640,26 +3643,30 @@ void Channel::UpdatePlayoutTimestamp(bool rtcp) {
return;
}
- jitter_buffer_playout_timestamp_ = playout_timestamp;
+ {
+ CriticalSectionScoped cs(&video_sync_critsect_);
+ jitter_buffer_playout_timestamp_ = playout_timestamp;
- // Remove the playout delay.
- playout_timestamp -= (delay_ms * (GetPlayoutFrequency() / 1000));
+ // Remove the playout delay.
+ playout_timestamp -= (delay_ms * (GetPlayoutFrequency() / 1000));
- WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
- "Channel::UpdatePlayoutTimestamp() => playoutTimestamp = %lu",
- playout_timestamp);
+ WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,_channelId),
+ "Channel::UpdatePlayoutTimestamp() => playoutTimestamp = %lu",
+ playout_timestamp);
- if (rtcp) {
- playout_timestamp_rtcp_ = playout_timestamp;
- } else {
- playout_timestamp_rtp_ = playout_timestamp;
+ if (rtcp) {
+ playout_timestamp_rtcp_ = playout_timestamp;
+ } else {
+ playout_timestamp_rtp_ = playout_timestamp;
+ }
+ playout_delay_ms_ = delay_ms;
}
- playout_delay_ms_ = delay_ms;
}
int Channel::GetPlayoutTimestamp(unsigned int& timestamp) {
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::GetPlayoutTimestamp()");
+ CriticalSectionScoped cs(&video_sync_critsect_);
if (playout_timestamp_rtp_ == 0) {
_engineStatisticsPtr->SetLastError(
VE_CANNOT_RETRIEVE_VALUE, kTraceError,
@@ -3929,6 +3936,8 @@ void Channel::UpdatePacketDelay(uint32_t rtp_timestamp,
"Channel::UpdatePacketDelay(timestamp=%lu, sequenceNumber=%u)",
rtp_timestamp, sequence_number);
+ CriticalSectionScoped cs(&video_sync_critsect_);
+
// Get frequency of last received payload
int rtp_receive_frequency = GetPlayoutFrequency();
« webrtc/voice_engine/channel.h ('K') | « webrtc/voice_engine/channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698