Correct WebRtc_Word8 in adm
Correct WebRtc_Word8 usage in adm BUG=http://code.google.com/p/webrtc/issues/detail?id=311&sort=-id TEST=buidl on all platforms Review URL: https://webrtc-codereview.appspot.com/428001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1814 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
af1f792cc3
commit
28f3913ca9
@ -138,8 +138,9 @@ WebRtc_Word32 AudioDeviceAndroidOpenSLES::Init() {
|
||||
_recWarning = 0;
|
||||
_recError = 0;
|
||||
|
||||
SLEngineOption EngineOption[] = { (SLuint32) SL_ENGINEOPTION_THREADSAFE,
|
||||
(SLuint32) SL_BOOLEAN_TRUE };
|
||||
SLEngineOption EngineOption[] = {
|
||||
{ (SLuint32) SL_ENGINEOPTION_THREADSAFE, (SLuint32) SL_BOOLEAN_TRUE },
|
||||
};
|
||||
WebRtc_Word32 res = slCreateEngine(&_slEngineObject, 1, EngineOption, 0,
|
||||
NULL, NULL);
|
||||
//WebRtc_Word32 res = slCreateEngine( &_slEngineObject, 0, NULL, 0, NULL,
|
||||
@ -964,7 +965,7 @@ WebRtc_Word32 AudioDeviceAndroidOpenSLES::InitPlayout() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 res(-1);
|
||||
WebRtc_Word32 res = -1;
|
||||
SLDataFormat_PCM pcm;
|
||||
SLDataSource audioSource;
|
||||
SLDataLocator_AndroidSimpleBufferQueue simpleBufferQueue;
|
||||
@ -1120,17 +1121,13 @@ WebRtc_Word32 AudioDeviceAndroidOpenSLES::InitRecording() {
|
||||
" Recording object is NULL");
|
||||
return -1;
|
||||
}
|
||||
WebRtc_Word32 res(-1);
|
||||
WebRtc_Word32 numInputs(0);
|
||||
WebRtc_UWord32 inputDeviceIDs[N_MAX_INPUT_DEVICES];
|
||||
SLAudioInputDescriptor audioInputDescriptor;
|
||||
SLDataSource audioSource;
|
||||
SLDataLocator_IODevice micLocator;
|
||||
SLDataSink audioSink;
|
||||
SLDataFormat_PCM pcm;
|
||||
SLDataLocator_AndroidSimpleBufferQueue simpleBufferQueue;
|
||||
bool micAvailable(false);
|
||||
WebRtc_UWord32 micDeviceID(0);
|
||||
|
||||
// TODO(leozwang) clean up following commented out code
|
||||
// WebRtc_Word32 numInputs(0);
|
||||
// WebRtc_UWord32 inputDeviceIDs[N_MAX_INPUT_DEVICES];
|
||||
// SLAudioInputDescriptor audioInputDescriptor;
|
||||
// bool micAvailable(false);
|
||||
// WebRtc_UWord32 micDeviceID(0);
|
||||
|
||||
/* // Get the Audio IO DEVICE CAPABILITIES interface, which is also implicit
|
||||
res = (*_slEngineObject)->GetInterface(_slEngineObject,
|
||||
@ -1202,6 +1199,14 @@ WebRtc_Word32 AudioDeviceAndroidOpenSLES::InitRecording() {
|
||||
return -1;
|
||||
}
|
||||
*/
|
||||
|
||||
WebRtc_Word32 res(-1);
|
||||
SLDataSource audioSource;
|
||||
SLDataLocator_IODevice micLocator;
|
||||
SLDataSink audioSink;
|
||||
SLDataFormat_PCM pcm;
|
||||
SLDataLocator_AndroidSimpleBufferQueue simpleBufferQueue;
|
||||
|
||||
// Setup the data source structure
|
||||
micLocator.locatorType = SL_DATALOCATOR_IODEVICE;
|
||||
micLocator.deviceType = SL_IODEVICE_AUDIOINPUT;
|
||||
@ -1932,15 +1937,16 @@ void AudioDeviceAndroidOpenSLES::UpdateRecordingDelay() {
|
||||
|
||||
WebRtc_Word32 AudioDeviceAndroidOpenSLES::InitSampleRate() {
|
||||
|
||||
WebRtc_Word32 res(-1);
|
||||
WebRtc_Word32 numOutputs(0);
|
||||
WebRtc_UWord32 headsetDeviceID(0);
|
||||
WebRtc_UWord32 earpieceDeviceID(0);
|
||||
bool headsetAvailable(false);
|
||||
bool earpieceAvailable(false);
|
||||
bool foundSampleRate(false);
|
||||
WebRtc_UWord32 outputDeviceIDs[N_MAX_OUTPUT_DEVICES];
|
||||
SLAudioOutputDescriptor audioOutputDescriptor;
|
||||
// TODO(leozwang) clean up following commented out code
|
||||
// WebRtc_Word32 res(-1);
|
||||
// WebRtc_Word32 numOutputs(0);
|
||||
// WebRtc_UWord32 headsetDeviceID(0);
|
||||
// WebRtc_UWord32 earpieceDeviceID(0);
|
||||
// bool headsetAvailable(false);
|
||||
// bool earpieceAvailable(false);
|
||||
// bool foundSampleRate(false);
|
||||
// WebRtc_UWord32 outputDeviceIDs[N_MAX_OUTPUT_DEVICES];
|
||||
// SLAudioOutputDescriptor audioOutputDescriptor;
|
||||
|
||||
if (_slEngineObject == NULL) {
|
||||
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id, " SL Object is NULL");
|
||||
|
@ -247,6 +247,7 @@ private:
|
||||
SLDeviceVolumeItf _slMicVolume;
|
||||
|
||||
WebRtc_UWord32 _micDeviceId;
|
||||
WebRtc_UWord32 _recQueueSeq;
|
||||
|
||||
// Events
|
||||
EventWrapper& _timeEventRec;
|
||||
@ -263,7 +264,6 @@ private:
|
||||
// Recording buffer
|
||||
WebRtc_Word8 _recQueueBuffer[N_REC_QUEUE_BUFFERS][2
|
||||
* REC_BUF_SIZE_IN_SAMPLES];
|
||||
WebRtc_UWord32 _recQueueSeq;
|
||||
WebRtc_Word8 _recBuffer[N_REC_BUFFERS][2*REC_BUF_SIZE_IN_SAMPLES];
|
||||
WebRtc_UWord32 _recLength[N_REC_BUFFERS];
|
||||
WebRtc_UWord32 _recSeqNumber[N_REC_BUFFERS];
|
||||
|
@ -322,7 +322,8 @@ WebRtc_Word32 AudioDeviceBuffer::SetVQEData(WebRtc_UWord32 playDelayMS, WebRtc_U
|
||||
// StartInputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceBuffer::StartInputFileRecording(const WebRtc_Word8 fileName[kAdmMaxFileNameSize])
|
||||
WebRtc_Word32 AudioDeviceBuffer::StartInputFileRecording(
|
||||
const char fileName[kAdmMaxFileNameSize])
|
||||
{
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__);
|
||||
|
||||
@ -354,7 +355,8 @@ WebRtc_Word32 AudioDeviceBuffer::StopInputFileRecording()
|
||||
// StartOutputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceBuffer::StartOutputFileRecording(const WebRtc_Word8 fileName[kAdmMaxFileNameSize])
|
||||
WebRtc_Word32 AudioDeviceBuffer::StartOutputFileRecording(
|
||||
const char fileName[kAdmMaxFileNameSize])
|
||||
{
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, _id, "%s", __FUNCTION__);
|
||||
|
||||
@ -618,8 +620,8 @@ WebRtc_Word32 AudioDeviceBuffer::GetPlayoutData(WebRtc_Word8* audioBuffer)
|
||||
WEBRTC_TRACE(kTraceError, kTraceUtility, _id, "_playSize %i exceeds "
|
||||
"kMaxBufferSizeBytes in AudioDeviceBuffer::GetPlayoutData", _playSize);
|
||||
assert(false);
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(audioBuffer, &_playBuffer[0], _playSize);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -44,21 +44,28 @@ public:
|
||||
WebRtc_Word32 SetPlayoutChannels(WebRtc_UWord8 channels);
|
||||
WebRtc_UWord8 RecordingChannels() const;
|
||||
WebRtc_UWord8 PlayoutChannels() const;
|
||||
WebRtc_Word32 SetRecordingChannel(const AudioDeviceModule::ChannelType channel);
|
||||
WebRtc_Word32 RecordingChannel(AudioDeviceModule::ChannelType& channel) const;
|
||||
WebRtc_Word32 SetRecordingChannel(
|
||||
const AudioDeviceModule::ChannelType channel);
|
||||
WebRtc_Word32 RecordingChannel(
|
||||
AudioDeviceModule::ChannelType& channel) const;
|
||||
|
||||
WebRtc_Word32 SetRecordedBuffer(const WebRtc_Word8* audioBuffer, WebRtc_UWord32 nSamples);
|
||||
WebRtc_Word32 SetRecordedBuffer(const WebRtc_Word8* audioBuffer,
|
||||
WebRtc_UWord32 nSamples);
|
||||
WebRtc_Word32 SetCurrentMicLevel(WebRtc_UWord32 level);
|
||||
WebRtc_Word32 SetVQEData(WebRtc_UWord32 playDelayMS, WebRtc_UWord32 recDelayMS, WebRtc_Word32 clockDrift);
|
||||
WebRtc_Word32 SetVQEData(WebRtc_UWord32 playDelayMS,
|
||||
WebRtc_UWord32 recDelayMS,
|
||||
WebRtc_Word32 clockDrift);
|
||||
WebRtc_Word32 DeliverRecordedData();
|
||||
WebRtc_UWord32 NewMicLevel() const;
|
||||
|
||||
WebRtc_Word32 RequestPlayoutData(WebRtc_UWord32 nSamples);
|
||||
WebRtc_Word32 GetPlayoutData(WebRtc_Word8* audioBuffer);
|
||||
|
||||
WebRtc_Word32 StartInputFileRecording(const WebRtc_Word8 fileName[kAdmMaxFileNameSize]);
|
||||
WebRtc_Word32 StartInputFileRecording(
|
||||
const char fileName[kAdmMaxFileNameSize]);
|
||||
WebRtc_Word32 StopInputFileRecording();
|
||||
WebRtc_Word32 StartOutputFileRecording(const WebRtc_Word8 fileName[kAdmMaxFileNameSize]);
|
||||
WebRtc_Word32 StartOutputFileRecording(
|
||||
const char fileName[kAdmMaxFileNameSize]);
|
||||
WebRtc_Word32 StopOutputFileRecording();
|
||||
|
||||
AudioDeviceBuffer();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -34,12 +34,12 @@ class AudioDeviceGeneric
|
||||
virtual WebRtc_Word16 RecordingDevices() = 0;
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]) = 0;
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) = 0;
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]) = 0;
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]) = 0;
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index) = 0;
|
||||
|
@ -1468,7 +1468,10 @@ WebRtc_Word32 AudioDeviceModuleImpl::SetPlayoutDevice(WindowsDeviceType device)
|
||||
// PlayoutDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
@ -1499,7 +1502,10 @@ WebRtc_Word32 AudioDeviceModuleImpl::PlayoutDeviceName(WebRtc_UWord16 index, Web
|
||||
// RecordingDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
@ -1536,7 +1542,8 @@ WebRtc_Word16 AudioDeviceModuleImpl::RecordingDevices()
|
||||
|
||||
WebRtc_UWord16 nRecordingDevices = _ptrAudioDevice->RecordingDevices();
|
||||
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: #recording devices=%d", nRecordingDevices);
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
|
||||
"output: #recording devices=%d", nRecordingDevices);
|
||||
return ((WebRtc_Word16)nRecordingDevices);
|
||||
}
|
||||
|
||||
@ -1698,7 +1705,8 @@ WebRtc_Word32 AudioDeviceModuleImpl::RegisterAudioCallback(AudioTransport* audio
|
||||
// StartRawInputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::StartRawInputFileRecording(const WebRtc_Word8 pcmFileNameUTF8[kAdmMaxFileNameSize])
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::StartRawInputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize])
|
||||
{
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
@ -1725,7 +1733,8 @@ WebRtc_Word32 AudioDeviceModuleImpl::StopRawInputFileRecording()
|
||||
// StartRawOutputFileRecording
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::StartRawOutputFileRecording(const WebRtc_Word8 pcmFileNameUTF8[kAdmMaxFileNameSize])
|
||||
WebRtc_Word32 AudioDeviceModuleImpl::StartRawOutputFileRecording(
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize])
|
||||
{
|
||||
CHECK_INITIALIZED();
|
||||
|
||||
@ -2037,22 +2046,28 @@ AudioDeviceModule::AudioLayer AudioDeviceModuleImpl::PlatformAudioLayer() const
|
||||
switch (_platformAudioLayer)
|
||||
{
|
||||
case kPlatformDefaultAudio:
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: kPlatformDefaultAudio");
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
|
||||
"output: kPlatformDefaultAudio");
|
||||
break;
|
||||
case kWindowsWaveAudio:
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: kWindowsWaveAudio");
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
|
||||
"output: kWindowsWaveAudio");
|
||||
break;
|
||||
case kWindowsCoreAudio:
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: kWindowsCoreAudio");
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
|
||||
"output: kWindowsCoreAudio");
|
||||
break;
|
||||
case kLinuxAlsaAudio:
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: kLinuxAlsaAudio");
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
|
||||
"output: kLinuxAlsaAudio");
|
||||
break;
|
||||
case kDummyAudio:
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id, "output: kDummyAudio");
|
||||
WEBRTC_TRACE(kTraceStateInfo, kTraceAudioDevice, _id,
|
||||
"output: kDummyAudio");
|
||||
break;
|
||||
default:
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, "output: INVALID");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
"output: INVALID");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -74,12 +74,12 @@ public:
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
@ -179,10 +179,10 @@ public:
|
||||
|
||||
// Recording of raw PCM data
|
||||
virtual WebRtc_Word32 StartRawOutputFileRecording(
|
||||
const WebRtc_Word8 pcmFileNameUTF8[kAdmMaxFileNameSize]);
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]);
|
||||
virtual WebRtc_Word32 StopRawOutputFileRecording();
|
||||
virtual WebRtc_Word32 StartRawInputFileRecording(
|
||||
const WebRtc_Word8 pcmFileNameUTF8[kAdmMaxFileNameSize]);
|
||||
const char pcmFileNameUTF8[kAdmMaxFileNameSize]);
|
||||
virtual WebRtc_Word32 StopRawInputFileRecording();
|
||||
|
||||
// Native sample rate controls (samples/sec)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -42,7 +42,9 @@ WebRtc_UWord32 AudioDeviceUtility::GetTimeInMS()
|
||||
return timeGetTime();
|
||||
}
|
||||
|
||||
bool AudioDeviceUtility::StringCompare(const WebRtc_Word8* str1 , const WebRtc_Word8* str2, const WebRtc_UWord32 length)
|
||||
bool AudioDeviceUtility::StringCompare(
|
||||
const char* str1 , const char* str2,
|
||||
const WebRtc_UWord32 length)
|
||||
{
|
||||
return ((_strnicmp(str1, str2, length) == 0) ? true : false);
|
||||
}
|
||||
@ -61,7 +63,7 @@ bool AudioDeviceUtility::StringCompare(const WebRtc_Word8* str1 , const WebRtc_W
|
||||
#include <stdio.h> // getchar
|
||||
#include <termios.h> // tcgetattr
|
||||
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace webrtc
|
||||
{
|
||||
@ -112,7 +114,8 @@ void AudioDeviceUtility::Sleep(WebRtc_UWord32 milliseconds)
|
||||
nanosleep(&t,NULL);
|
||||
}
|
||||
|
||||
bool AudioDeviceUtility::StringCompare(const WebRtc_Word8* str1 , const WebRtc_Word8* str2, const WebRtc_UWord32 length)
|
||||
bool AudioDeviceUtility::StringCompare(
|
||||
const char* str1 , const char* str2, const WebRtc_UWord32 length)
|
||||
{
|
||||
return (strncasecmp(str1, str2, length) == 0)?true: false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -22,8 +22,8 @@ public:
|
||||
static WebRtc_UWord32 GetTimeInMS();
|
||||
static void Sleep(WebRtc_UWord32 milliseconds);
|
||||
static void WaitForKey();
|
||||
static bool StringCompare(const WebRtc_Word8* str1,
|
||||
const WebRtc_Word8* str2,
|
||||
static bool StringCompare(const char* str1,
|
||||
const char* str2,
|
||||
const WebRtc_UWord32 length);
|
||||
virtual WebRtc_Word32 Init() = 0;
|
||||
|
||||
|
@ -135,7 +135,8 @@ void AudioDeviceDummy::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer)
|
||||
// ActiveAudioLayer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::ActiveAudioLayer(AudioDeviceModule::AudioLayer& audioLayer) const
|
||||
WebRtc_Word32 AudioDeviceDummy::ActiveAudioLayer(
|
||||
AudioDeviceModule::AudioLayer& audioLayer) const
|
||||
{
|
||||
audioLayer = AudioDeviceModule::kDummyAudio;
|
||||
return 0;
|
||||
@ -161,25 +162,29 @@ WebRtc_Word32 AudioDeviceDummy::Init()
|
||||
|
||||
// RECORDING
|
||||
strncpy(threadName, "webrtc_audio_module_rec_thread", 63);
|
||||
_ptrThreadRec = ThreadWrapper::CreateThread(RecThreadFunc, this, kRealtimePriority, threadName);
|
||||
_ptrThreadRec = ThreadWrapper::CreateThread(
|
||||
RecThreadFunc, this, kRealtimePriority, threadName);
|
||||
if (_ptrThreadRec == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, " failed to create the rec audio thread");
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||
" failed to create the rec audio thread");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!_ptrThreadRec->Start(threadID))
|
||||
{
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, " failed to start the rec audio thread");
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||
" failed to start the rec audio thread");
|
||||
delete _ptrThreadRec;
|
||||
_ptrThreadRec = NULL;
|
||||
return -1;
|
||||
}
|
||||
_recThreadID = threadID;
|
||||
|
||||
|
||||
if (!_timeEventRec.StartTimer(periodic, REC_TIMER_PERIOD_MS))
|
||||
{
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, " failed to start the rec timer event");
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||
" failed to start the rec timer event");
|
||||
if (_ptrThreadRec->Stop())
|
||||
{
|
||||
delete _ptrThreadRec;
|
||||
@ -187,33 +192,38 @@ WebRtc_Word32 AudioDeviceDummy::Init()
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " unable to stop the activated rec thread");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" unable to stop the activated rec thread");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// PLAYOUT
|
||||
strncpy(threadName, "webrtc_audio_module_play_thread", 63);
|
||||
_ptrThreadPlay = ThreadWrapper::CreateThread(PlayThreadFunc, this, kRealtimePriority, threadName);
|
||||
_ptrThreadPlay = ThreadWrapper::CreateThread(
|
||||
PlayThreadFunc, this, kRealtimePriority, threadName);
|
||||
if (_ptrThreadPlay == NULL)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, " failed to create the play audio thread");
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||
" failed to create the play audio thread");
|
||||
return -1;
|
||||
}
|
||||
|
||||
threadID = 0;
|
||||
if (!_ptrThreadPlay->Start(threadID))
|
||||
{
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, " failed to start the play audio thread");
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||
" failed to start the play audio thread");
|
||||
delete _ptrThreadPlay;
|
||||
_ptrThreadPlay = NULL;
|
||||
return -1;
|
||||
}
|
||||
_playThreadID = threadID;
|
||||
|
||||
|
||||
if (!_timeEventPlay.StartTimer(periodic, PLAY_TIMER_PERIOD_MS))
|
||||
{
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id, " failed to start the play timer event");
|
||||
WEBRTC_TRACE(kTraceCritical, kTraceAudioDevice, _id,
|
||||
" failed to start the play timer event");
|
||||
if (_ptrThreadPlay->Stop())
|
||||
{
|
||||
delete _ptrThreadPlay;
|
||||
@ -221,7 +231,8 @@ WebRtc_Word32 AudioDeviceDummy::Init()
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " unable to stop the activated play thread");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" unable to stop the activated play thread");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -261,7 +272,8 @@ WebRtc_Word32 AudioDeviceDummy::Terminate()
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " failed to close down the rec audio thread");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" failed to close down the rec audio thread");
|
||||
}
|
||||
|
||||
_critSect.Enter();
|
||||
@ -285,7 +297,8 @@ WebRtc_Word32 AudioDeviceDummy::Terminate()
|
||||
}
|
||||
else
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " failed to close down the play audio thread");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" failed to close down the play audio thread");
|
||||
}
|
||||
|
||||
_critSect.Enter();
|
||||
@ -696,7 +709,8 @@ WebRtc_Word32 AudioDeviceDummy::MicrophoneVolumeIsAvailable(bool& available)
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::SetMicrophoneVolume(WebRtc_UWord32 volume)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "AudioDeviceDummy::SetMicrophoneVolume(volume=%u)", volume);
|
||||
WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id,
|
||||
"AudioDeviceDummy::SetMicrophoneVolume(volume=%u)", volume);
|
||||
|
||||
CriticalSectionScoped lock(_critSect);
|
||||
|
||||
@ -720,7 +734,8 @@ WebRtc_Word32 AudioDeviceDummy::MicrophoneVolume(WebRtc_UWord32& volume) const
|
||||
// MaxMicrophoneVolume
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) const
|
||||
WebRtc_Word32 AudioDeviceDummy::MaxMicrophoneVolume(
|
||||
WebRtc_UWord32& maxVolume) const
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStream, kTraceAudioDevice, _id, "%s", __FUNCTION__);
|
||||
|
||||
@ -731,7 +746,8 @@ WebRtc_Word32 AudioDeviceDummy::MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) c
|
||||
// MinMicrophoneVolume
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::MinMicrophoneVolume(WebRtc_UWord32& minVolume) const
|
||||
WebRtc_Word32 AudioDeviceDummy::MinMicrophoneVolume(
|
||||
WebRtc_UWord32& minVolume) const
|
||||
{
|
||||
|
||||
return -1;
|
||||
@ -741,7 +757,8 @@ WebRtc_Word32 AudioDeviceDummy::MinMicrophoneVolume(WebRtc_UWord32& minVolume) c
|
||||
// MicrophoneVolumeStepSize
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::MicrophoneVolumeStepSize(WebRtc_UWord16& stepSize) const
|
||||
WebRtc_Word32 AudioDeviceDummy::MicrophoneVolumeStepSize(
|
||||
WebRtc_UWord16& stepSize) const
|
||||
{
|
||||
|
||||
return -1;
|
||||
@ -783,7 +800,8 @@ WebRtc_Word32 AudioDeviceDummy::SetPlayoutDevice(WebRtc_UWord16 index)
|
||||
// SetPlayoutDevice II (II)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::SetPlayoutDevice(AudioDeviceModule::WindowsDeviceType device)
|
||||
WebRtc_Word32 AudioDeviceDummy::SetPlayoutDevice(
|
||||
AudioDeviceModule::WindowsDeviceType device)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -792,7 +810,10 @@ WebRtc_Word32 AudioDeviceDummy::SetPlayoutDevice(AudioDeviceModule::WindowsDevic
|
||||
// PlayoutDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceDummy::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
if (index != 0)
|
||||
@ -814,7 +835,10 @@ WebRtc_Word32 AudioDeviceDummy::PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_W
|
||||
// RecordingDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceDummy::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
if (index != 0)
|
||||
@ -868,7 +892,8 @@ WebRtc_Word32 AudioDeviceDummy::SetRecordingDevice(WebRtc_UWord16 index)
|
||||
// SetRecordingDevice II (II)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::SetRecordingDevice(AudioDeviceModule::WindowsDeviceType device)
|
||||
WebRtc_Word32 AudioDeviceDummy::SetRecordingDevice(
|
||||
AudioDeviceModule::WindowsDeviceType device)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -896,7 +921,7 @@ WebRtc_Word32 AudioDeviceDummy::RecordingIsAvailable(bool& available)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// InitPlayout
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -919,7 +944,8 @@ WebRtc_Word32 AudioDeviceDummy::InitPlayout()
|
||||
// Initialize the speaker (devices might have been added or removed)
|
||||
if (InitSpeaker() == -1)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " InitSpeaker() failed");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" InitSpeaker() failed");
|
||||
}
|
||||
|
||||
_playIsInitialized = true;
|
||||
@ -949,7 +975,8 @@ WebRtc_Word32 AudioDeviceDummy::InitRecording()
|
||||
// Initialize the microphone (devices might have been added or removed)
|
||||
if (InitMicrophone() == -1)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id, " InitMicrophone() failed");
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" InitMicrophone() failed");
|
||||
}
|
||||
|
||||
_recIsInitialized = true;
|
||||
@ -1106,7 +1133,8 @@ bool AudioDeviceDummy::Playing() const
|
||||
// SetPlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::SetPlayoutBuffer(const AudioDeviceModule::BufferType type, WebRtc_UWord16 sizeMS)
|
||||
WebRtc_Word32 AudioDeviceDummy::SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type, WebRtc_UWord16 sizeMS)
|
||||
{
|
||||
|
||||
CriticalSectionScoped lock(_critSect);
|
||||
@ -1120,7 +1148,8 @@ WebRtc_Word32 AudioDeviceDummy::SetPlayoutBuffer(const AudioDeviceModule::Buffer
|
||||
// PlayoutBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceDummy::PlayoutBuffer(AudioDeviceModule::BufferType& type, WebRtc_UWord16& sizeMS) const
|
||||
WebRtc_Word32 AudioDeviceDummy::PlayoutBuffer(
|
||||
AudioDeviceModule::BufferType& type, WebRtc_UWord16& sizeMS) const
|
||||
{
|
||||
CriticalSectionScoped lock(_critSect);
|
||||
|
||||
@ -1253,7 +1282,7 @@ bool AudioDeviceDummy::PlayThreadProcess()
|
||||
}
|
||||
|
||||
Lock();
|
||||
|
||||
|
||||
if(_playing)
|
||||
{
|
||||
WebRtc_Word8 playBuffer[2*160];
|
||||
@ -1274,7 +1303,7 @@ bool AudioDeviceDummy::PlayThreadProcess()
|
||||
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
|
||||
" invalid number of output samples(%d)", nSamples);
|
||||
}
|
||||
|
||||
|
||||
if (_playDataFile)
|
||||
{
|
||||
int wr = fwrite(playBuffer, 2, 160, _playDataFile);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -25,27 +25,35 @@ class AudioDeviceDummy : public AudioDeviceGeneric
|
||||
public:
|
||||
AudioDeviceDummy(const WebRtc_Word32 id);
|
||||
~AudioDeviceDummy();
|
||||
|
||||
|
||||
// Retrieve the currently utilized audio layer
|
||||
virtual WebRtc_Word32 ActiveAudioLayer(AudioDeviceModule::AudioLayer& audioLayer) const;
|
||||
|
||||
|
||||
// Main initializaton and termination
|
||||
virtual WebRtc_Word32 Init();
|
||||
virtual WebRtc_Word32 Terminate();
|
||||
virtual bool Initialized() const;
|
||||
|
||||
|
||||
// Device enumeration
|
||||
virtual WebRtc_Word16 PlayoutDevices();
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(AudioDeviceModule::WindowsDeviceType device);
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(
|
||||
AudioDeviceModule::WindowsDeviceType device);
|
||||
virtual WebRtc_Word32 SetRecordingDevice(WebRtc_UWord16 index);
|
||||
virtual WebRtc_Word32 SetRecordingDevice(AudioDeviceModule::WindowsDeviceType device);
|
||||
|
||||
virtual WebRtc_Word32 SetRecordingDevice(
|
||||
AudioDeviceModule::WindowsDeviceType device);
|
||||
|
||||
// Audio transport initialization
|
||||
virtual WebRtc_Word32 PlayoutIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitPlayout();
|
||||
@ -53,7 +61,7 @@ public:
|
||||
virtual WebRtc_Word32 RecordingIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitRecording();
|
||||
virtual bool RecordingIsInitialized() const;
|
||||
|
||||
|
||||
// Audio transport control
|
||||
virtual WebRtc_Word32 StartPlayout();
|
||||
virtual WebRtc_Word32 StopPlayout();
|
||||
@ -61,15 +69,17 @@ public:
|
||||
virtual WebRtc_Word32 StartRecording();
|
||||
virtual WebRtc_Word32 StopRecording();
|
||||
virtual bool Recording() const;
|
||||
|
||||
|
||||
// Microphone Automatic Gain Control (AGC)
|
||||
virtual WebRtc_Word32 SetAGC(bool enable);
|
||||
virtual bool AGC() const;
|
||||
|
||||
|
||||
// Volume control based on the Windows Wave API (Windows only)
|
||||
virtual WebRtc_Word32 SetWaveOutVolume(WebRtc_UWord16 volumeLeft, WebRtc_UWord16 volumeRight);
|
||||
virtual WebRtc_Word32 WaveOutVolume(WebRtc_UWord16& volumeLeft, WebRtc_UWord16& volumeRight) const;
|
||||
|
||||
virtual WebRtc_Word32 SetWaveOutVolume(
|
||||
WebRtc_UWord16 volumeLeft, WebRtc_UWord16 volumeRight);
|
||||
virtual WebRtc_Word32 WaveOutVolume(
|
||||
WebRtc_UWord16& volumeLeft, WebRtc_UWord16& volumeRight) const;
|
||||
|
||||
// Audio mixer initialization
|
||||
virtual WebRtc_Word32 SpeakerIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitSpeaker();
|
||||
@ -77,7 +87,7 @@ public:
|
||||
virtual WebRtc_Word32 MicrophoneIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 InitMicrophone();
|
||||
virtual bool MicrophoneIsInitialized() const;
|
||||
|
||||
|
||||
// Speaker volume controls
|
||||
virtual WebRtc_Word32 SpeakerVolumeIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetSpeakerVolume(WebRtc_UWord32 volume);
|
||||
@ -85,30 +95,31 @@ public:
|
||||
virtual WebRtc_Word32 MaxSpeakerVolume(WebRtc_UWord32& maxVolume) const;
|
||||
virtual WebRtc_Word32 MinSpeakerVolume(WebRtc_UWord32& minVolume) const;
|
||||
virtual WebRtc_Word32 SpeakerVolumeStepSize(WebRtc_UWord16& stepSize) const;
|
||||
|
||||
|
||||
// Microphone volume controls
|
||||
virtual WebRtc_Word32 MicrophoneVolumeIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetMicrophoneVolume(WebRtc_UWord32 volume);
|
||||
virtual WebRtc_Word32 MicrophoneVolume(WebRtc_UWord32& volume) const;
|
||||
virtual WebRtc_Word32 MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) const;
|
||||
virtual WebRtc_Word32 MinMicrophoneVolume(WebRtc_UWord32& minVolume) const;
|
||||
virtual WebRtc_Word32 MicrophoneVolumeStepSize(WebRtc_UWord16& stepSize) const;
|
||||
|
||||
virtual WebRtc_Word32 MicrophoneVolumeStepSize(
|
||||
WebRtc_UWord16& stepSize) const;
|
||||
|
||||
// Speaker mute control
|
||||
virtual WebRtc_Word32 SpeakerMuteIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetSpeakerMute(bool enable);
|
||||
virtual WebRtc_Word32 SpeakerMute(bool& enabled) const;
|
||||
|
||||
|
||||
// Microphone mute control
|
||||
virtual WebRtc_Word32 MicrophoneMuteIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetMicrophoneMute(bool enable);
|
||||
virtual WebRtc_Word32 MicrophoneMute(bool& enabled) const;
|
||||
|
||||
|
||||
// Microphone boost control
|
||||
virtual WebRtc_Word32 MicrophoneBoostIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetMicrophoneBoost(bool enable);
|
||||
virtual WebRtc_Word32 MicrophoneBoost(bool& enabled) const;
|
||||
|
||||
|
||||
// Stereo support
|
||||
virtual WebRtc_Word32 StereoPlayoutIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetStereoPlayout(bool enable);
|
||||
@ -116,16 +127,18 @@ public:
|
||||
virtual WebRtc_Word32 StereoRecordingIsAvailable(bool& available);
|
||||
virtual WebRtc_Word32 SetStereoRecording(bool enable);
|
||||
virtual WebRtc_Word32 StereoRecording(bool& enabled) const;
|
||||
|
||||
|
||||
// Delay information and control
|
||||
virtual WebRtc_Word32 SetPlayoutBuffer(const AudioDeviceModule::BufferType type, WebRtc_UWord16 sizeMS);
|
||||
virtual WebRtc_Word32 PlayoutBuffer(AudioDeviceModule::BufferType& type, WebRtc_UWord16& sizeMS) const;
|
||||
virtual WebRtc_Word32 SetPlayoutBuffer(
|
||||
const AudioDeviceModule::BufferType type, WebRtc_UWord16 sizeMS);
|
||||
virtual WebRtc_Word32 PlayoutBuffer(
|
||||
AudioDeviceModule::BufferType& type, WebRtc_UWord16& sizeMS) const;
|
||||
virtual WebRtc_Word32 PlayoutDelay(WebRtc_UWord16& delayMS) const;
|
||||
virtual WebRtc_Word32 RecordingDelay(WebRtc_UWord16& delayMS) const;
|
||||
|
||||
|
||||
// CPU load
|
||||
virtual WebRtc_Word32 CPULoad(WebRtc_UWord16& load) const;
|
||||
|
||||
|
||||
virtual bool PlayoutWarning() const;
|
||||
virtual bool PlayoutError() const;
|
||||
virtual bool RecordingWarning() const;
|
||||
@ -134,32 +147,32 @@ public:
|
||||
virtual void ClearPlayoutError();
|
||||
virtual void ClearRecordingWarning();
|
||||
virtual void ClearRecordingError();
|
||||
|
||||
|
||||
virtual void AttachAudioBuffer(AudioDeviceBuffer* audioBuffer);
|
||||
|
||||
|
||||
private:
|
||||
void Lock() { _critSect.Enter(); };
|
||||
void UnLock() { _critSect.Leave(); };
|
||||
|
||||
|
||||
static bool RecThreadFunc(void*);
|
||||
static bool PlayThreadFunc(void*);
|
||||
bool RecThreadProcess();
|
||||
bool PlayThreadProcess();
|
||||
|
||||
|
||||
AudioDeviceBuffer* _ptrAudioBuffer;
|
||||
CriticalSectionWrapper& _critSect;
|
||||
WebRtc_Word32 _id;
|
||||
|
||||
|
||||
EventWrapper& _timeEventRec;
|
||||
EventWrapper& _timeEventPlay;
|
||||
EventWrapper& _recStartEvent;
|
||||
EventWrapper& _playStartEvent;
|
||||
|
||||
|
||||
ThreadWrapper* _ptrThreadRec;
|
||||
ThreadWrapper* _ptrThreadPlay;
|
||||
WebRtc_UWord32 _recThreadID;
|
||||
WebRtc_UWord32 _playThreadID;
|
||||
|
||||
|
||||
bool _initialized;
|
||||
bool _recording;
|
||||
bool _playing;
|
||||
@ -167,9 +180,9 @@ private:
|
||||
bool _playIsInitialized;
|
||||
bool _speakerIsInitialized;
|
||||
bool _microphoneIsInitialized;
|
||||
|
||||
|
||||
WebRtc_Word8 _recBuffer[2*160];
|
||||
|
||||
|
||||
FILE* _playDataFile;
|
||||
};
|
||||
|
||||
|
@ -932,8 +932,8 @@ WebRtc_Word32 AudioDeviceLinuxALSA::SetPlayoutDevice(
|
||||
|
||||
WebRtc_Word32 AudioDeviceLinuxALSA::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
const WebRtc_UWord16 nDevices(PlayoutDevices());
|
||||
@ -955,8 +955,8 @@ WebRtc_Word32 AudioDeviceLinuxALSA::PlayoutDeviceName(
|
||||
|
||||
WebRtc_Word32 AudioDeviceLinuxALSA::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
const WebRtc_UWord16 nDevices(RecordingDevices());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -45,12 +45,12 @@ public:
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
|
@ -1071,8 +1071,8 @@ WebRtc_Word32 AudioDeviceLinuxPulse::SetPlayoutDevice(
|
||||
|
||||
WebRtc_Word32 AudioDeviceLinuxPulse::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
const WebRtc_UWord16 nDevices = PlayoutDevices();
|
||||
@ -1113,8 +1113,8 @@ WebRtc_Word32 AudioDeviceLinuxPulse::PlayoutDeviceName(
|
||||
|
||||
WebRtc_Word32 AudioDeviceLinuxPulse::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
const WebRtc_UWord16 nDevices(RecordingDevices());
|
||||
@ -2124,13 +2124,13 @@ WebRtc_Word32 AudioDeviceLinuxPulse::InitSamplingFrequency()
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioDeviceLinuxPulse::GetDefaultDeviceInfo(bool recDevice,
|
||||
WebRtc_Word8* name,
|
||||
char* name,
|
||||
WebRtc_UWord16& index)
|
||||
{
|
||||
WebRtc_Word8 tmpName[kAdmMaxDeviceNameSize] = {0};
|
||||
char tmpName[kAdmMaxDeviceNameSize] = {0};
|
||||
// subtract length of "default: "
|
||||
WebRtc_UWord16 nameLen = kAdmMaxDeviceNameSize - 9;
|
||||
WebRtc_Word8* pName = NULL;
|
||||
char* pName = NULL;
|
||||
|
||||
if (name)
|
||||
{
|
||||
@ -2792,7 +2792,7 @@ bool AudioDeviceLinuxPulse::PlayThreadProcess()
|
||||
if (_outputDeviceIndex > 0)
|
||||
{
|
||||
// Get the playout device name
|
||||
_playDeviceName = new WebRtc_Word8[kAdmMaxDeviceNameSize];
|
||||
_playDeviceName = new char[kAdmMaxDeviceNameSize];
|
||||
_deviceIndex = _outputDeviceIndex;
|
||||
PlayoutDevices();
|
||||
}
|
||||
@ -3026,7 +3026,7 @@ bool AudioDeviceLinuxPulse::RecThreadProcess()
|
||||
if (_inputDeviceIndex > 0)
|
||||
{
|
||||
// Get the recording device name
|
||||
_recDeviceName = new WebRtc_Word8[kAdmMaxDeviceNameSize];
|
||||
_recDeviceName = new char[kAdmMaxDeviceNameSize];
|
||||
_deviceIndex = _inputDeviceIndex;
|
||||
RecordingDevices();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -113,12 +113,12 @@ public:
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
@ -278,7 +278,7 @@ private:
|
||||
|
||||
WebRtc_Word32 CheckPulseAudioVersion();
|
||||
WebRtc_Word32 InitSamplingFrequency();
|
||||
WebRtc_Word32 GetDefaultDeviceInfo(bool recDevice, WebRtc_Word8* name,
|
||||
WebRtc_Word32 GetDefaultDeviceInfo(bool recDevice, char* name,
|
||||
WebRtc_UWord16& index);
|
||||
WebRtc_Word32 InitPulseAudio();
|
||||
WebRtc_Word32 TerminatePulseAudio();
|
||||
@ -346,11 +346,11 @@ private:
|
||||
WebRtc_UWord16 _deviceIndex;
|
||||
WebRtc_Word16 _numPlayDevices;
|
||||
WebRtc_Word16 _numRecDevices;
|
||||
WebRtc_Word8* _playDeviceName;
|
||||
WebRtc_Word8* _recDeviceName;
|
||||
WebRtc_Word8* _playDisplayDeviceName;
|
||||
WebRtc_Word8* _recDisplayDeviceName;
|
||||
WebRtc_Word8 _paServerVersion[32];
|
||||
char* _playDeviceName;
|
||||
char* _recDeviceName;
|
||||
char* _playDisplayDeviceName;
|
||||
char* _recDisplayDeviceName;
|
||||
char _paServerVersion[32];
|
||||
|
||||
WebRtc_Word8* _playBuffer;
|
||||
size_t _playbackBufferSize;
|
||||
|
@ -1109,7 +1109,7 @@ void AudioMixerManagerLinuxPulse::PaSinkInputInfoCallbackHandler(
|
||||
{
|
||||
if (eol)
|
||||
{
|
||||
// Signal that we are done.
|
||||
// Signal that we are done
|
||||
LATE(pa_threaded_mainloop_signal)(_paMainloop, 0);
|
||||
return;
|
||||
}
|
||||
|
@ -1139,8 +1139,8 @@ WebRtc_Word32 AudioDeviceMac::SetPlayoutDevice(
|
||||
|
||||
WebRtc_Word32 AudioDeviceMac::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
const WebRtc_UWord16 nDevices(PlayoutDevices());
|
||||
@ -1162,8 +1162,8 @@ WebRtc_Word32 AudioDeviceMac::PlayoutDeviceName(
|
||||
|
||||
WebRtc_Word32 AudioDeviceMac::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
const WebRtc_UWord16 nDevices(RecordingDevices());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -78,12 +78,12 @@ public:
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
WebRtc_Word8 name[kAdmMaxDeviceNameSize],
|
||||
WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
|
@ -1857,7 +1857,10 @@ WebRtc_Word32 AudioDeviceWindowsCore::SetPlayoutDevice(AudioDeviceModule::Window
|
||||
// PlayoutDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceWindowsCore::PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceWindowsCore::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
bool defaultCommunicationDevice(false);
|
||||
@ -1935,7 +1938,10 @@ WebRtc_Word32 AudioDeviceWindowsCore::PlayoutDeviceName(WebRtc_UWord16 index, We
|
||||
// RecordingDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceWindowsCore::RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceWindowsCore::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
bool defaultCommunicationDevice(false);
|
||||
|
@ -100,8 +100,14 @@ public:
|
||||
// Device enumeration
|
||||
virtual WebRtc_Word16 PlayoutDevices();
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
|
@ -1374,7 +1374,10 @@ WebRtc_Word32 AudioDeviceWindowsWave::SetPlayoutDevice(AudioDeviceModule::Window
|
||||
// PlayoutDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceWindowsWave::PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceWindowsWave::PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
WebRtc_UWord16 nDevices(PlayoutDevices());
|
||||
@ -1476,7 +1479,10 @@ WebRtc_Word32 AudioDeviceWindowsWave::PlayoutDeviceName(WebRtc_UWord16 index, We
|
||||
// RecordingDeviceName
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WebRtc_Word32 AudioDeviceWindowsWave::RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize])
|
||||
WebRtc_Word32 AudioDeviceWindowsWave::RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize])
|
||||
{
|
||||
|
||||
WebRtc_UWord16 nDevices(RecordingDevices());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -54,8 +54,14 @@ public:
|
||||
// Device enumeration
|
||||
virtual WebRtc_Word16 PlayoutDevices();
|
||||
virtual WebRtc_Word16 RecordingDevices();
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(WebRtc_UWord16 index, WebRtc_Word8 name[kAdmMaxDeviceNameSize], WebRtc_Word8 guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 PlayoutDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
virtual WebRtc_Word32 RecordingDeviceName(
|
||||
WebRtc_UWord16 index,
|
||||
char name[kAdmMaxDeviceNameSize],
|
||||
char guid[kAdmMaxGuidSize]);
|
||||
|
||||
// Device selection
|
||||
virtual WebRtc_Word32 SetPlayoutDevice(WebRtc_UWord16 index);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
||||
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
@ -20,7 +20,9 @@
|
||||
// Helper functions
|
||||
#if defined(ANDROID)
|
||||
char filenameStr[2][256] =
|
||||
{ 0}; // Allow two buffers for those API calls taking two filenames
|
||||
{ {0},
|
||||
{0},
|
||||
}; // Allow two buffers for those API calls taking two filenames
|
||||
int currentStr = 0;
|
||||
|
||||
char* GetFilename(char* filename)
|
||||
@ -192,10 +194,7 @@ private:
|
||||
WebRtc_UWord32 _playCount;
|
||||
};
|
||||
|
||||
int api_test();
|
||||
|
||||
|
||||
#if !defined(MAC_IPHONE) && !defined(ANDROID)
|
||||
#if !defined(MAC_IPHONE)
|
||||
int api_test();
|
||||
|
||||
int main(int /*argc*/, char* /*argv*/[])
|
||||
@ -2122,7 +2121,7 @@ int api_test()
|
||||
TEST(audioDevice->SetPlayoutDevice(MACRO_DEFAULT_DEVICE) == 0);
|
||||
TEST(audioDevice->SetRecordingDevice(MACRO_DEFAULT_DEVICE) == 0);
|
||||
|
||||
#if defined(MAC_IPHONE)
|
||||
#if defined(MAC_IPHONE)
|
||||
// Not playing or recording, should just return 0
|
||||
TEST(audioDevice->ResetAudioDevice() == 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user