Fixes crash due to r841.
Review URL: http://webrtc-codereview.appspot.com/256004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@853 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
e9f909b575
commit
b37c628ae4
@ -474,6 +474,12 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetMixabilityStatus(
|
|||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"SetMixabilityStatus(participant,mixable:%s)",
|
"SetMixabilityStatus(participant,mixable:%s)",
|
||||||
mixable ? "true" : "false");
|
mixable ? "true" : "false");
|
||||||
|
if (!mixable)
|
||||||
|
{
|
||||||
|
// Anonymous participants are in a separate list. Make sure that the
|
||||||
|
// participant is in the _participantList if it is being mixed.
|
||||||
|
SetAnonymousMixabilityStatus(participant, false);
|
||||||
|
}
|
||||||
WebRtc_UWord32 amountOfMixableParticipants;
|
WebRtc_UWord32 amountOfMixableParticipants;
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(*_cbCrit);
|
||||||
|
@ -3437,47 +3437,57 @@ int Channel::StartPlayingFileLocally(const char* fileName,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CriticalSectionScoped cs(_fileCritSect);
|
|
||||||
|
|
||||||
if (_outputFilePlayerPtr)
|
|
||||||
{
|
{
|
||||||
_outputFilePlayerPtr->RegisterModuleFileCallback(NULL);
|
CriticalSectionScoped cs(_fileCritSect);
|
||||||
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
|
||||||
_outputFilePlayerPtr = NULL;
|
if (_outputFilePlayerPtr)
|
||||||
}
|
{
|
||||||
|
_outputFilePlayerPtr->RegisterModuleFileCallback(NULL);
|
||||||
_outputFilePlayerPtr = FilePlayer::CreateFilePlayer(
|
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
||||||
_outputFilePlayerId, (const FileFormats)format);
|
_outputFilePlayerPtr = NULL;
|
||||||
|
}
|
||||||
if (_outputFilePlayerPtr == NULL)
|
|
||||||
{
|
_outputFilePlayerPtr = FilePlayer::CreateFilePlayer(
|
||||||
_engineStatisticsPtr->SetLastError(
|
_outputFilePlayerId, (const FileFormats)format);
|
||||||
VE_INVALID_ARGUMENT, kTraceError,
|
|
||||||
"StartPlayingFileLocally() filePlayer format isnot correct");
|
if (_outputFilePlayerPtr == NULL)
|
||||||
return -1;
|
{
|
||||||
}
|
_engineStatisticsPtr->SetLastError(
|
||||||
|
VE_INVALID_ARGUMENT, kTraceError,
|
||||||
const WebRtc_UWord32 notificationTime(0);
|
"StartPlayingFileLocally() filePlayer format isnot correct");
|
||||||
|
return -1;
|
||||||
if (_outputFilePlayerPtr->StartPlayingFile(
|
}
|
||||||
fileName,
|
|
||||||
loop,
|
const WebRtc_UWord32 notificationTime(0);
|
||||||
startPosition,
|
|
||||||
volumeScaling,
|
if (_outputFilePlayerPtr->StartPlayingFile(
|
||||||
notificationTime,
|
fileName,
|
||||||
stopPosition,
|
loop,
|
||||||
(const CodecInst*)codecInst) != 0)
|
startPosition,
|
||||||
{
|
volumeScaling,
|
||||||
_engineStatisticsPtr->SetLastError(
|
notificationTime,
|
||||||
VE_BAD_FILE, kTraceError,
|
stopPosition,
|
||||||
"StartPlayingFile() failed to start file playout");
|
(const CodecInst*)codecInst) != 0)
|
||||||
_outputFilePlayerPtr->StopPlayingFile();
|
{
|
||||||
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
_engineStatisticsPtr->SetLastError(
|
||||||
_outputFilePlayerPtr = NULL;
|
VE_BAD_FILE, kTraceError,
|
||||||
return -1;
|
"StartPlayingFile() failed to start file playout");
|
||||||
|
_outputFilePlayerPtr->StopPlayingFile();
|
||||||
|
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
||||||
|
_outputFilePlayerPtr = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
_outputFilePlayerPtr->RegisterModuleFileCallback(this);
|
||||||
|
_outputFilePlaying = true;
|
||||||
}
|
}
|
||||||
|
// _fileCritSect cannot be taken while calling
|
||||||
|
// SetAnonymousMixabilityStatus since as soon as the participant is added
|
||||||
|
// frames can be pulled by the mixer. Since the frames are generated from
|
||||||
|
// the file, _fileCritSect will be taken. This would result in a deadlock.
|
||||||
if (_outputMixerPtr->SetAnonymousMixabilityStatus(*this, true) != 0)
|
if (_outputMixerPtr->SetAnonymousMixabilityStatus(*this, true) != 0)
|
||||||
{
|
{
|
||||||
|
CriticalSectionScoped cs(_fileCritSect);
|
||||||
|
_outputFilePlaying = false;
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_AUDIO_CONF_MIX_MODULE_ERROR, kTraceError,
|
VE_AUDIO_CONF_MIX_MODULE_ERROR, kTraceError,
|
||||||
"StartPlayingFile() failed to add participant as file to mixer");
|
"StartPlayingFile() failed to add participant as file to mixer");
|
||||||
@ -3486,8 +3496,6 @@ int Channel::StartPlayingFileLocally(const char* fileName,
|
|||||||
_outputFilePlayerPtr = NULL;
|
_outputFilePlayerPtr = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
_outputFilePlayerPtr->RegisterModuleFileCallback(this);
|
|
||||||
_outputFilePlaying = true;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3521,45 +3529,55 @@ int Channel::StartPlayingFileLocally(InStream* stream,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CriticalSectionScoped cs(_fileCritSect);
|
|
||||||
|
|
||||||
// Destroy the old instance
|
|
||||||
if (_outputFilePlayerPtr)
|
|
||||||
{
|
{
|
||||||
_outputFilePlayerPtr->RegisterModuleFileCallback(NULL);
|
CriticalSectionScoped cs(_fileCritSect);
|
||||||
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
|
||||||
_outputFilePlayerPtr = NULL;
|
// Destroy the old instance
|
||||||
}
|
if (_outputFilePlayerPtr)
|
||||||
|
{
|
||||||
// Create the instance
|
_outputFilePlayerPtr->RegisterModuleFileCallback(NULL);
|
||||||
_outputFilePlayerPtr = FilePlayer::CreateFilePlayer(
|
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
||||||
_outputFilePlayerId,
|
_outputFilePlayerPtr = NULL;
|
||||||
(const FileFormats)format);
|
}
|
||||||
|
|
||||||
if (_outputFilePlayerPtr == NULL)
|
// Create the instance
|
||||||
{
|
_outputFilePlayerPtr = FilePlayer::CreateFilePlayer(
|
||||||
_engineStatisticsPtr->SetLastError(
|
_outputFilePlayerId,
|
||||||
VE_INVALID_ARGUMENT, kTraceError,
|
(const FileFormats)format);
|
||||||
"StartPlayingFileLocally() filePlayer format isnot correct");
|
|
||||||
return -1;
|
if (_outputFilePlayerPtr == NULL)
|
||||||
}
|
{
|
||||||
|
_engineStatisticsPtr->SetLastError(
|
||||||
const WebRtc_UWord32 notificationTime(0);
|
VE_INVALID_ARGUMENT, kTraceError,
|
||||||
|
"StartPlayingFileLocally() filePlayer format isnot correct");
|
||||||
if (_outputFilePlayerPtr->StartPlayingFile(*stream, startPosition,
|
return -1;
|
||||||
volumeScaling, notificationTime,
|
}
|
||||||
stopPosition, codecInst) != 0)
|
|
||||||
{
|
const WebRtc_UWord32 notificationTime(0);
|
||||||
_engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError,
|
|
||||||
"StartPlayingFile() failed to "
|
if (_outputFilePlayerPtr->StartPlayingFile(*stream, startPosition,
|
||||||
"start file playout");
|
volumeScaling,
|
||||||
_outputFilePlayerPtr->StopPlayingFile();
|
notificationTime,
|
||||||
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
stopPosition, codecInst) != 0)
|
||||||
_outputFilePlayerPtr = NULL;
|
{
|
||||||
return -1;
|
_engineStatisticsPtr->SetLastError(VE_BAD_FILE, kTraceError,
|
||||||
|
"StartPlayingFile() failed to "
|
||||||
|
"start file playout");
|
||||||
|
_outputFilePlayerPtr->StopPlayingFile();
|
||||||
|
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
||||||
|
_outputFilePlayerPtr = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
_outputFilePlayerPtr->RegisterModuleFileCallback(this);
|
||||||
|
_outputFilePlaying = true;
|
||||||
}
|
}
|
||||||
|
// _fileCritSect cannot be taken while calling
|
||||||
|
// SetAnonymousMixibilityStatus. Refer to comments in
|
||||||
|
// StartPlayingFileLocally(const char* ...) for more details.
|
||||||
if (_outputMixerPtr->SetAnonymousMixabilityStatus(*this, true) != 0)
|
if (_outputMixerPtr->SetAnonymousMixabilityStatus(*this, true) != 0)
|
||||||
{
|
{
|
||||||
|
CriticalSectionScoped cs(_fileCritSect);
|
||||||
|
_outputFilePlaying = false;
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_AUDIO_CONF_MIX_MODULE_ERROR, kTraceError,
|
VE_AUDIO_CONF_MIX_MODULE_ERROR, kTraceError,
|
||||||
"StartPlayingFile() failed to add participant as file to mixer");
|
"StartPlayingFile() failed to add participant as file to mixer");
|
||||||
@ -3569,9 +3587,6 @@ int Channel::StartPlayingFileLocally(InStream* stream,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_outputFilePlayerPtr->RegisterModuleFileCallback(this);
|
|
||||||
_outputFilePlaying = true;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3588,27 +3603,32 @@ int Channel::StopPlayingFileLocally()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CriticalSectionScoped cs(_fileCritSect);
|
|
||||||
|
|
||||||
if (_outputFilePlayerPtr->StopPlayingFile() != 0)
|
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
CriticalSectionScoped cs(_fileCritSect);
|
||||||
VE_STOP_RECORDING_FAILED, kTraceError,
|
|
||||||
"StopPlayingFile() could not stop playing");
|
if (_outputFilePlayerPtr->StopPlayingFile() != 0)
|
||||||
return -1;
|
{
|
||||||
|
_engineStatisticsPtr->SetLastError(
|
||||||
|
VE_STOP_RECORDING_FAILED, kTraceError,
|
||||||
|
"StopPlayingFile() could not stop playing");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
_outputFilePlayerPtr->RegisterModuleFileCallback(NULL);
|
||||||
|
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
||||||
|
_outputFilePlayerPtr = NULL;
|
||||||
|
_outputFilePlaying = false;
|
||||||
}
|
}
|
||||||
|
// _fileCritSect cannot be taken while calling
|
||||||
|
// SetAnonymousMixibilityStatus. Refer to comments in
|
||||||
|
// StartPlayingFileLocally(const char* ...) for more details.
|
||||||
if (_outputMixerPtr->SetAnonymousMixabilityStatus(*this, false) != 0)
|
if (_outputMixerPtr->SetAnonymousMixabilityStatus(*this, false) != 0)
|
||||||
{
|
{
|
||||||
_engineStatisticsPtr->SetLastError(
|
_engineStatisticsPtr->SetLastError(
|
||||||
VE_AUDIO_CONF_MIX_MODULE_ERROR, kTraceError,
|
VE_AUDIO_CONF_MIX_MODULE_ERROR, kTraceError,
|
||||||
"StopPlayingFile() failed to stop participant from playing as file"
|
"StopPlayingFile() failed to stop participant from playing as"
|
||||||
"in the mixer");
|
"file in the mixer");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
_outputFilePlayerPtr->RegisterModuleFileCallback(NULL);
|
|
||||||
FilePlayer::DestroyFilePlayer(_outputFilePlayerPtr);
|
|
||||||
_outputFilePlayerPtr = NULL;
|
|
||||||
_outputFilePlaying = false;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user