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
This commit is contained in:
xians@webrtc.org 2013-10-17 16:15:34 +00:00
parent e61da8c391
commit 675e260ad1
3 changed files with 18 additions and 4 deletions

View File

@ -76,9 +76,9 @@ void SharedData::set_audio_processing(AudioProcessing* audioproc) {
_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 @@ uint16_t SharedData::NumOfSendingChannels() {
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);
}

View File

@ -56,7 +56,8 @@ public:
_audioDeviceLayer = layer;
}
uint16_t NumOfSendingChannels();
int NumOfSendingChannels();
int NumOfPlayingChannels();
// Convenience methods for calling statistics().SetLastError().
void SetLastError(int32_t error) const;

View File

@ -999,7 +999,7 @@ int32_t VoEBaseImpl::StopPlayout() {
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,