Refine the error processing of StopRecordingMicrophone.

BUG = 
TEST = 
Review URL: https://webrtc-codereview.appspot.com/636007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2406 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
braveyao@webrtc.org 2012-06-15 02:37:53 +00:00
parent bdf7ee5bab
commit 4de777ba2b
2 changed files with 18 additions and 4 deletions

View File

@ -879,9 +879,9 @@ int TransmitMixer::StopRecordingMicrophone()
if (!_fileRecording)
{
WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, -1),
WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
"StopRecordingMicrophone() isnot recording");
return -1;
return 0;
}
CriticalSectionScoped cs(&_critSect);

View File

@ -614,6 +614,11 @@ int VoEFileImpl::StopRecordingMicrophone()
_shared->SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
int err = 0;
// TODO(xians): consider removing Start/StopRecording() in
// Start/StopRecordingMicrophone() if no channel is recording.
if (_shared->NumOfSendingChannels() == 0 &&
_shared->audio_device()->Recording())
{
@ -622,10 +627,19 @@ int VoEFileImpl::StopRecordingMicrophone()
{
_shared->SetLastError(VE_CANNOT_STOP_RECORDING, kTraceError,
"StopRecordingMicrophone() failed to stop recording");
return -1;
err = -1;
}
}
return _shared->transmit_mixer()->StopRecordingMicrophone();
if (_shared->transmit_mixer()->StopRecordingMicrophone() != 0)
{
WEBRTC_TRACE(kTraceError, kTraceVoice,
VoEId(_shared->instance_id(), -1),
"StopRecordingMicrophone() failed to stop recording to mixer");
err = -1;
}
return err;
}
// TODO(andrew): a cursory inspection suggests there's a large amount of