Resolve a crash related to pulseAudio where we need to check if

pa_context_get_source_info_by_name/pa_context_get_sink_info_by_name 
has early failure and returns NULL,then to avoid WaitForOperationCompletion
from crashing, paOperation must be checked to ensure it is not NULL.

Please note that ::WaitForOperationCompletion( ) is a void function
therefore returning without any error code if paOperation is indeed NULL

Google internal bug id [4356730]
Review URL: http://webrtc-codereview.appspot.com/122003

git-svn-id: http://webrtc.googlecode.com/svn/trunk@417 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
punyabrata@google.com 2011-08-22 22:35:14 +00:00
parent 288c8698cb
commit 9695e75fbd

View File

@ -2509,6 +2509,13 @@ void AudioDeviceLinuxPulse::PaUnLock()
void AudioDeviceLinuxPulse::WaitForOperationCompletion(
pa_operation* paOperation) const
{
if (!paOperation)
{
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
"paOperation NULL in WaitForOperationCompletion");
return;
}
while (LATE(pa_operation_get_state)(paOperation) == PA_OPERATION_RUNNING)
{
LATE(pa_threaded_mainloop_wait)(_paMainloop);