Removes WebRtc_Word8 dependecy in the AudioDeviceModule.

This CL also modifies the ADM callback interface and introduces void* instead of WebRtc_Word8*
as pointer types for data buffers. This change also affects the VoiceEngine.
Review URL: https://webrtc-codereview.appspot.com/443001

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1863 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrika@webrtc.org 2012-03-09 08:59:19 +00:00
parent de011c1131
commit 907bc55c19
12 changed files with 29 additions and 29 deletions

View File

@ -54,7 +54,7 @@ protected:
class AudioTransport
{
public:
virtual int32_t RecordedDataIsAvailable(const char* audioSamples,
virtual int32_t RecordedDataIsAvailable(const void* audioSamples,
const uint32_t nSamples,
const uint8_t nBytesPerSample,
const uint8_t nChannels,
@ -68,7 +68,7 @@ public:
const uint8_t nBytesPerSample,
const uint8_t nChannels,
const uint32_t samplesPerSec,
char* audioSamples,
void* audioSamples,
uint32_t& nSamplesOut) = 0;
protected:

View File

@ -100,7 +100,6 @@ void AudioDeviceBuffer::SetId(WebRtc_UWord32 id)
WebRtc_Word32 AudioDeviceBuffer::RegisterAudioCallback(AudioTransport* audioCallback)
{
CriticalSectionScoped lock(_critSectCb);
_ptrCbAudioTransport = audioCallback;
@ -399,7 +398,8 @@ WebRtc_Word32 AudioDeviceBuffer::StopOutputFileRecording()
// 16-bit,48kHz stereo,10ms => nSamples=480 => _recSize=4*480=1920 bytes
// ----------------------------------------------------------------------------
WebRtc_Word32 AudioDeviceBuffer::SetRecordedBuffer(const WebRtc_Word8* audioBuffer, WebRtc_UWord32 nSamples)
WebRtc_Word32 AudioDeviceBuffer::SetRecordedBuffer(const void* audioBuffer,
WebRtc_UWord32 nSamples)
{
CriticalSectionScoped lock(_critSect);
@ -611,7 +611,7 @@ WebRtc_Word32 AudioDeviceBuffer::RequestPlayoutData(WebRtc_UWord32 nSamples)
// GetPlayoutData
// ----------------------------------------------------------------------------
WebRtc_Word32 AudioDeviceBuffer::GetPlayoutData(WebRtc_Word8* audioBuffer)
WebRtc_Word32 AudioDeviceBuffer::GetPlayoutData(void* audioBuffer)
{
CriticalSectionScoped lock(_critSect);

View File

@ -49,7 +49,7 @@ public:
WebRtc_Word32 RecordingChannel(
AudioDeviceModule::ChannelType& channel) const;
WebRtc_Word32 SetRecordedBuffer(const WebRtc_Word8* audioBuffer,
WebRtc_Word32 SetRecordedBuffer(const void* audioBuffer,
WebRtc_UWord32 nSamples);
WebRtc_Word32 SetCurrentMicLevel(WebRtc_UWord32 level);
WebRtc_Word32 SetVQEData(WebRtc_UWord32 playDelayMS,
@ -59,7 +59,7 @@ public:
WebRtc_UWord32 NewMicLevel() const;
WebRtc_Word32 RequestPlayoutData(WebRtc_UWord32 nSamples);
WebRtc_Word32 GetPlayoutData(WebRtc_Word8* audioBuffer);
WebRtc_Word32 GetPlayoutData(void* audioBuffer);
WebRtc_Word32 StartInputFileRecording(
const char fileName[kAdmMaxFileNameSize]);
@ -95,14 +95,14 @@ private:
WebRtc_UWord8 _playBytesPerSample;
// 10ms in stereo @ 96kHz
WebRtc_Word8 _recBuffer[kMaxBufferSizeBytes];
int8_t _recBuffer[kMaxBufferSizeBytes];
// one sample <=> 2 or 4 bytes
WebRtc_UWord32 _recSamples;
WebRtc_UWord32 _recSize; // in bytes
// 10ms in stereo @ 96kHz
WebRtc_Word8 _playBuffer[kMaxBufferSizeBytes];
int8_t _playBuffer[kMaxBufferSizeBytes];
// one sample <=> 2 or 4 bytes
WebRtc_UWord32 _playSamples;

View File

@ -1835,7 +1835,7 @@ WebRtc_Word32 AudioDeviceWindowsWave::InitPlayout()
for (int n = 0; n < N_BUFFERS_OUT; n++)
{
// set up the output wave header
_waveHeaderOut[n].lpData = _playBuffer[n];
_waveHeaderOut[n].lpData = reinterpret_cast<LPSTR>(&_playBuffer[n]);
_waveHeaderOut[n].dwBufferLength = bytesPerSample*PLAY_BUF_SIZE_IN_SAMPLES;
_waveHeaderOut[n].dwFlags = 0;
_waveHeaderOut[n].dwLoops = 0;
@ -2676,7 +2676,7 @@ WebRtc_Word32 AudioDeviceWindowsWave::PrepareStartPlayout()
// A total of 30ms of data is immediately placed in the SC buffer
//
WebRtc_Word8 zeroVec[4*PLAY_BUF_SIZE_IN_SAMPLES]; // max allocation
int8_t zeroVec[4*PLAY_BUF_SIZE_IN_SAMPLES]; // max allocation
memset(zeroVec, 0, 4*PLAY_BUF_SIZE_IN_SAMPLES);
{
@ -2736,7 +2736,7 @@ WebRtc_Word32 AudioDeviceWindowsWave::PrepareStartRecording()
const WebRtc_UWord8 nBytesPerSample = 2*_recChannels;
// set up the input wave header
_waveHeaderIn[n].lpData = _recBuffer[n];
_waveHeaderIn[n].lpData = reinterpret_cast<LPSTR>(&_recBuffer[n]);
_waveHeaderIn[n].dwBufferLength = nBytesPerSample * REC_BUF_SIZE_IN_SAMPLES;
_waveHeaderIn[n].dwFlags = 0;
_waveHeaderIn[n].dwBytesRecorded = 0;
@ -3475,7 +3475,7 @@ WebRtc_Word32 AudioDeviceWindowsWave::RecProc(LONGLONG& consumedTime)
int AudioDeviceWindowsWave::PlayProc(LONGLONG& consumedTime)
{
WebRtc_Word32 remTimeMS(0);
WebRtc_Word8 playBuffer[4*PLAY_BUF_SIZE_IN_SAMPLES];
int8_t playBuffer[4*PLAY_BUF_SIZE_IN_SAMPLES];
WebRtc_UWord32 writtenSamples(0);
WebRtc_UWord32 playedSamples(0);
@ -3626,7 +3626,7 @@ int AudioDeviceWindowsWave::PlayProc(LONGLONG& consumedTime)
// Write
// ----------------------------------------------------------------------------
WebRtc_Word32 AudioDeviceWindowsWave::Write(WebRtc_Word8* data, WebRtc_UWord16 nSamples)
WebRtc_Word32 AudioDeviceWindowsWave::Write(int8_t* data, WebRtc_UWord16 nSamples)
{
if (_hWaveOut == NULL)
{

View File

@ -191,7 +191,7 @@ private:
WebRtc_Word32 GetPlayoutBufferDelay(WebRtc_UWord32& writtenSamples, WebRtc_UWord32& playedSamples);
WebRtc_Word32 GetRecordingBufferDelay(WebRtc_UWord32& readSamples, WebRtc_UWord32& recSamples);
WebRtc_Word32 Write(WebRtc_Word8* data, WebRtc_UWord16 nSamples);
WebRtc_Word32 Write(int8_t* data, WebRtc_UWord16 nSamples);
WebRtc_Word32 GetClockDrift(const WebRtc_UWord32 plSamp, const WebRtc_UWord32 rcSamp);
WebRtc_Word32 MonitorRecording(const WebRtc_UWord32 time);
WebRtc_Word32 RestartTimerIfNeeded(const WebRtc_UWord32 time);
@ -253,8 +253,8 @@ private:
WebRtc_UWord16 _recDelayCount;
WebRtc_UWord16 _recPutBackDelay;
WebRtc_Word8 _recBuffer[N_BUFFERS_IN][4*REC_BUF_SIZE_IN_SAMPLES];
WebRtc_Word8 _playBuffer[N_BUFFERS_OUT][4*PLAY_BUF_SIZE_IN_SAMPLES];
int8_t _recBuffer[N_BUFFERS_IN][4*REC_BUF_SIZE_IN_SAMPLES];
int8_t _playBuffer[N_BUFFERS_OUT][4*PLAY_BUF_SIZE_IN_SAMPLES];
AudioDeviceModule::BufferType _playBufType;

View File

@ -84,7 +84,7 @@ class AudioTransportAPI: public AudioTransport {
~AudioTransportAPI() {}
virtual WebRtc_Word32 RecordedDataIsAvailable(
const WebRtc_Word8* audioSamples,
const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
@ -114,7 +114,7 @@ class AudioTransportAPI: public AudioTransport {
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 sampleRate,
WebRtc_Word8* audioSamples,
void* audioSamples,
WebRtc_UWord32& nSamplesOut) {
play_count_++;
if (play_count_ % 100 == 0) {

View File

@ -169,7 +169,7 @@ void AudioTransportImpl::SetFullDuplex(bool enable)
}
WebRtc_Word32 AudioTransportImpl::RecordedDataIsAvailable(
const WebRtc_Word8* audioSamples,
const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
@ -318,7 +318,7 @@ WebRtc_Word32 AudioTransportImpl::NeedMorePlayData(
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,
WebRtc_Word8* audioSamples,
void* audioSamples,
WebRtc_UWord32& nSamplesOut)
{
if (_fullDuplex)

View File

@ -97,7 +97,7 @@ class AudioTransportImpl: public AudioTransport
{
public:
virtual WebRtc_Word32
RecordedDataIsAvailable(const WebRtc_Word8* audioSamples,
RecordedDataIsAvailable(const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
@ -111,7 +111,7 @@ public:
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,
WebRtc_Word8* audioSamples,
void* audioSamples,
WebRtc_UWord32& nSamplesOut);
AudioTransportImpl(AudioDeviceModule* audioDevice);

View File

@ -298,7 +298,7 @@ TransmitMixer::SetAudioProcessingModule(AudioProcessing* audioProcessingModule)
}
WebRtc_Word32
TransmitMixer::PrepareDemux(const WebRtc_Word8* audioSamples,
TransmitMixer::PrepareDemux(const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,

View File

@ -52,7 +52,7 @@ public:
WebRtc_Word32 SetAudioProcessingModule(
AudioProcessing* audioProcessingModule);
WebRtc_Word32 PrepareDemux(const WebRtc_Word8* audioSamples,
WebRtc_Word32 PrepareDemux(const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,

View File

@ -139,7 +139,7 @@ void VoEBaseImpl::OnWarningIsReported(const WarningCode warning)
}
WebRtc_Word32 VoEBaseImpl::RecordedDataIsAvailable(
const WebRtc_Word8* audioSamples,
const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
@ -250,7 +250,7 @@ WebRtc_Word32 VoEBaseImpl::NeedMorePlayData(
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,
WebRtc_Word8* audioSamples,
void* audioSamples,
WebRtc_UWord32& nSamplesOut)
{
WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),

View File

@ -97,7 +97,7 @@ public:
// AudioTransport
virtual WebRtc_Word32
RecordedDataIsAvailable(const WebRtc_Word8* audioSamples,
RecordedDataIsAvailable(const void* audioSamples,
const WebRtc_UWord32 nSamples,
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
@ -111,7 +111,7 @@ public:
const WebRtc_UWord8 nBytesPerSample,
const WebRtc_UWord8 nChannels,
const WebRtc_UWord32 samplesPerSec,
WebRtc_Word8* audioSamples,
void* audioSamples,
WebRtc_UWord32& nSamplesOut);
// AudioDeviceObserver