diff options
author | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-08-07 17:57:36 +0000 |
---|---|---|
committer | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-08-07 17:57:36 +0000 |
commit | b3ada1540827c60a63058570a94a57dfd260ad11 (patch) | |
tree | 4111b0516651b8faa696542ec02b30fad770c879 /voice_engine/voe_volume_control_impl.cc | |
parent | d7b06eca993d068de0d579a83511640d74ab9f77 (diff) | |
download | webrtc-b3ada1540827c60a63058570a94a57dfd260ad11.tar.gz |
Ref-counted rewrite of ChannelManager.
The complexity of the last ChannelManager and potentially usage of it as well caused race conditions and deadlocks in loopback voe_auto_test. This ref-counted solution takes no long-term locks, uses less locks overall and is significantly easier to understand.
ScopedChannel has been split up into a ChannelOwner with a reference to a channel and an Iterator over ChannelManager. Previous code was really used for both things. ChannelOwner is used as a shared pointer to a channel object, while an Iterator should work as expected.
BUG=2081
R=tommi@webrtc.org, xians@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/1802004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@4502 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'voice_engine/voe_volume_control_impl.cc')
-rw-r--r-- | voice_engine/voe_volume_control_impl.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/voice_engine/voe_volume_control_impl.cc b/voice_engine/voe_volume_control_impl.cc index c7555fcf..62f709f7 100644 --- a/voice_engine/voe_volume_control_impl.cc +++ b/voice_engine/voe_volume_control_impl.cc @@ -297,8 +297,8 @@ int VoEVolumeControlImpl::SetInputMute(int channel, bool enable) else { // Mute after demultiplexing <=> affects one channel only - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -326,8 +326,8 @@ int VoEVolumeControlImpl::GetInputMute(int channel, bool& enabled) } else { - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -422,8 +422,8 @@ int VoEVolumeControlImpl::GetSpeechOutputLevel(int channel, } else { - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -472,8 +472,8 @@ int VoEVolumeControlImpl::GetSpeechOutputLevelFullRange(int channel, } else { - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -503,8 +503,8 @@ int VoEVolumeControlImpl::SetChannelOutputVolumeScaling(int channel, "SetChannelOutputVolumeScaling() invalid parameter"); return -1; } - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -524,8 +524,8 @@ int VoEVolumeControlImpl::GetChannelOutputVolumeScaling(int channel, _shared->SetLastError(VE_NOT_INITED, kTraceError); return -1; } - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -577,8 +577,8 @@ int VoEVolumeControlImpl::SetOutputVolumePan(int channel, else { // Per-channel balance (affects the signal before output mixing) - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, @@ -620,8 +620,8 @@ int VoEVolumeControlImpl::GetOutputVolumePan(int channel, } else { - voe::ScopedChannel sc(_shared->channel_manager(), channel); - voe::Channel* channelPtr = sc.ChannelPtr(); + voe::ChannelOwner ch = _shared->channel_manager().GetChannel(channel); + voe::Channel* channelPtr = ch.channel(); if (channelPtr == NULL) { _shared->SetLastError(VE_CHANNEL_NOT_VALID, kTraceError, |