Check the number of playout channels instead of the send channels in StopPlayout()
BUG=2467
R=henrika@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/2420004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@4989 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/voice_engine/shared_data.cc b/webrtc/voice_engine/shared_data.cc
index 2d485ae..712bb66 100644
--- a/webrtc/voice_engine/shared_data.cc
+++ b/webrtc/voice_engine/shared_data.cc
@@ -76,9 +76,9 @@
_outputMixerPtr->SetAudioProcessingModule(audioproc);
}
-uint16_t SharedData::NumOfSendingChannels() {
+int SharedData::NumOfSendingChannels() {
ChannelManager::Iterator it(&_channelManager);
- uint16_t sending_channels = 0;
+ int sending_channels = 0;
for (ChannelManager::Iterator it(&_channelManager); it.IsValid();
it.Increment()) {
@@ -89,6 +89,19 @@
return sending_channels;
}
+int SharedData::NumOfPlayingChannels() {
+ ChannelManager::Iterator it(&_channelManager);
+ int playout_channels = 0;
+
+ for (ChannelManager::Iterator it(&_channelManager); it.IsValid();
+ it.Increment()) {
+ if (it.GetChannel()->Playing())
+ ++playout_channels;
+ }
+
+ return playout_channels;
+}
+
void SharedData::SetLastError(int32_t error) const {
_engineStatistics.SetLastError(error);
}
diff --git a/webrtc/voice_engine/shared_data.h b/webrtc/voice_engine/shared_data.h
index 7c7ad5c..dd76e96 100644
--- a/webrtc/voice_engine/shared_data.h
+++ b/webrtc/voice_engine/shared_data.h
@@ -56,7 +56,8 @@
_audioDeviceLayer = layer;
}
- uint16_t NumOfSendingChannels();
+ int NumOfSendingChannels();
+ int NumOfPlayingChannels();
// Convenience methods for calling statistics().SetLastError().
void SetLastError(int32_t error) const;
diff --git a/webrtc/voice_engine/voe_base_impl.cc b/webrtc/voice_engine/voe_base_impl.cc
index ab78f77..c76e06d 100644
--- a/webrtc/voice_engine/voe_base_impl.cc
+++ b/webrtc/voice_engine/voe_base_impl.cc
@@ -999,7 +999,7 @@
VoEId(_shared->instance_id(), -1),
"VoEBaseImpl::StopPlayout()");
// Stop audio-device playing if no channel is playing out
- if (_shared->NumOfSendingChannels() == 0) {
+ if (_shared->NumOfPlayingChannels() == 0) {
if (_shared->audio_device()->StopPlayout() != 0) {
_shared->SetLastError(VE_CANNOT_STOP_PLAYOUT,
kTraceError,