| Index: webrtc/voice_engine/transmit_mixer.cc
|
| diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc
|
| index 32f48482c08a9f05de0e2e7654cc3a1f93db8136..51718c6c60e667c7682393f060b84c38e67b5b83 100644
|
| --- a/webrtc/voice_engine/transmit_mixer.cc
|
| +++ b/webrtc/voice_engine/transmit_mixer.cc
|
| @@ -67,64 +67,6 @@ void TransmitMixer::OnPeriodicProcess()
|
| }
|
| #endif // WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
|
|
| -void TransmitMixer::PlayNotification(int32_t id,
|
| - uint32_t durationMs)
|
| -{
|
| - WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::PlayNotification(id=%d, durationMs=%d)",
|
| - id, durationMs);
|
| -
|
| - // Not implement yet
|
| -}
|
| -
|
| -void TransmitMixer::RecordNotification(int32_t id,
|
| - uint32_t durationMs)
|
| -{
|
| - WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId,-1),
|
| - "TransmitMixer::RecordNotification(id=%d, durationMs=%d)",
|
| - id, durationMs);
|
| -
|
| - // Not implement yet
|
| -}
|
| -
|
| -void TransmitMixer::PlayFileEnded(int32_t id)
|
| -{
|
| - WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::PlayFileEnded(id=%d)", id);
|
| -
|
| - assert(id == _filePlayerId);
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - _filePlaying = false;
|
| - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::PlayFileEnded() =>"
|
| - "file player module is shutdown");
|
| -}
|
| -
|
| -void
|
| -TransmitMixer::RecordFileEnded(int32_t id)
|
| -{
|
| - WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::RecordFileEnded(id=%d)", id);
|
| -
|
| - if (id == _fileRecorderId)
|
| - {
|
| - rtc::CritScope cs(&_critSect);
|
| - _fileRecording = false;
|
| - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::RecordFileEnded() => fileRecorder module"
|
| - "is shutdown");
|
| - } else if (id == _fileCallRecorderId)
|
| - {
|
| - rtc::CritScope cs(&_critSect);
|
| - _fileCallRecording = false;
|
| - WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::RecordFileEnded() => fileCallRecorder"
|
| - "module is shutdown");
|
| - }
|
| -}
|
| -
|
| int32_t
|
| TransmitMixer::Create(TransmitMixer*& mixer, uint32_t instanceId)
|
| {
|
| @@ -152,11 +94,6 @@ TransmitMixer::Destroy(TransmitMixer*& mixer)
|
| }
|
|
|
| TransmitMixer::TransmitMixer(uint32_t instanceId) :
|
| - // Avoid conflict with other channels by adding 1024 - 1026,
|
| - // won't use as much as 1024 channels.
|
| - _filePlayerId(instanceId + 1024),
|
| - _fileRecorderId(instanceId + 1025),
|
| - _fileCallRecorderId(instanceId + 1026),
|
| #if WEBRTC_VOICE_ENGINE_TYPING_DETECTION
|
| _monitorModule(this),
|
| #endif
|
| @@ -174,21 +111,6 @@ TransmitMixer::~TransmitMixer()
|
| if (_processThreadPtr)
|
| _processThreadPtr->DeRegisterModule(&_monitorModule);
|
| #endif
|
| - {
|
| - rtc::CritScope cs(&_critSect);
|
| - if (file_recorder_) {
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_recorder_->StopRecording();
|
| - }
|
| - if (file_call_recorder_) {
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_call_recorder_->StopRecording();
|
| - }
|
| - if (file_player_) {
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| - file_player_->StopPlayingFile();
|
| - }
|
| - }
|
| }
|
|
|
| int32_t
|
| @@ -295,23 +217,6 @@ TransmitMixer::PrepareDemux(const void* audioSamples,
|
| TypingDetection(keyPressed);
|
| #endif
|
|
|
| - // --- Mix with file (does not affect the mixing frequency)
|
| - if (_filePlaying)
|
| - {
|
| - MixOrReplaceAudioWithFile(_audioFrame.sample_rate_hz_);
|
| - }
|
| -
|
| - // --- Record to file
|
| - bool file_recording = false;
|
| - {
|
| - rtc::CritScope cs(&_critSect);
|
| - file_recording = _fileRecording;
|
| - }
|
| - if (file_recording)
|
| - {
|
| - RecordAudioToFile(_audioFrame.sample_rate_hz_);
|
| - }
|
| -
|
| // --- Measure audio level of speech after all processing.
|
| double sample_duration = static_cast<double>(nSamples) / samplesPerSec;
|
| _audioLevel.ComputeLevel(_audioFrame, sample_duration);
|
| @@ -344,509 +249,6 @@ TransmitMixer::StopSend()
|
| return 0;
|
| }
|
|
|
| -int TransmitMixer::StartPlayingFileAsMicrophone(const char* fileName,
|
| - bool loop,
|
| - FileFormats format,
|
| - int startPosition,
|
| - float volumeScaling,
|
| - int stopPosition,
|
| - const CodecInst* codecInst)
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StartPlayingFileAsMicrophone("
|
| - "fileNameUTF8[]=%s,loop=%d, format=%d, volumeScaling=%5.3f,"
|
| - " startPosition=%d, stopPosition=%d)", fileName, loop,
|
| - format, volumeScaling, startPosition, stopPosition);
|
| -
|
| - if (_filePlaying)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_ALREADY_PLAYING, kTraceWarning,
|
| - "StartPlayingFileAsMicrophone() is already playing");
|
| - return 0;
|
| - }
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - // Destroy the old instance
|
| - if (file_player_) {
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| - file_player_.reset();
|
| - }
|
| -
|
| - // Dynamically create the instance
|
| - file_player_ =
|
| - FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format);
|
| -
|
| - if (!file_player_) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_INVALID_ARGUMENT, kTraceError,
|
| - "StartPlayingFileAsMicrophone() filePlayer format isnot correct");
|
| - return -1;
|
| - }
|
| -
|
| - const uint32_t notificationTime(0);
|
| -
|
| - if (file_player_->StartPlayingFile(
|
| - fileName, loop, startPosition, volumeScaling, notificationTime,
|
| - stopPosition, (const CodecInst*)codecInst) != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartPlayingFile() failed to start file playout");
|
| - file_player_->StopPlayingFile();
|
| - file_player_.reset();
|
| - return -1;
|
| - }
|
| -
|
| - file_player_->RegisterModuleFileCallback(this);
|
| - _filePlaying = true;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::StartPlayingFileAsMicrophone(InStream* stream,
|
| - FileFormats format,
|
| - int startPosition,
|
| - float volumeScaling,
|
| - int stopPosition,
|
| - const CodecInst* codecInst)
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1),
|
| - "TransmitMixer::StartPlayingFileAsMicrophone(format=%d,"
|
| - " volumeScaling=%5.3f, startPosition=%d, stopPosition=%d)",
|
| - format, volumeScaling, startPosition, stopPosition);
|
| -
|
| - if (stream == NULL)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartPlayingFileAsMicrophone() NULL as input stream");
|
| - return -1;
|
| - }
|
| -
|
| - if (_filePlaying)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_ALREADY_PLAYING, kTraceWarning,
|
| - "StartPlayingFileAsMicrophone() is already playing");
|
| - return 0;
|
| - }
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - // Destroy the old instance
|
| - if (file_player_) {
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| - file_player_.reset();
|
| - }
|
| -
|
| - // Dynamically create the instance
|
| - file_player_ =
|
| - FilePlayer::CreateFilePlayer(_filePlayerId, (const FileFormats)format);
|
| -
|
| - if (!file_player_) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_INVALID_ARGUMENT, kTraceWarning,
|
| - "StartPlayingFileAsMicrophone() filePlayer format isnot correct");
|
| - return -1;
|
| - }
|
| -
|
| - const uint32_t notificationTime(0);
|
| -
|
| - if (file_player_->StartPlayingFile(stream, startPosition, volumeScaling,
|
| - notificationTime, stopPosition,
|
| - (const CodecInst*)codecInst) != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartPlayingFile() failed to start file playout");
|
| - file_player_->StopPlayingFile();
|
| - file_player_.reset();
|
| - return -1;
|
| - }
|
| - file_player_->RegisterModuleFileCallback(this);
|
| - _filePlaying = true;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::StopPlayingFileAsMicrophone()
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,-1),
|
| - "TransmitMixer::StopPlayingFileAsMicrophone()");
|
| -
|
| - if (!_filePlaying)
|
| - {
|
| - return 0;
|
| - }
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - if (file_player_->StopPlayingFile() != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_CANNOT_STOP_PLAYOUT, kTraceError,
|
| - "StopPlayingFile() couldnot stop playing file");
|
| - return -1;
|
| - }
|
| -
|
| - file_player_->RegisterModuleFileCallback(NULL);
|
| - file_player_.reset();
|
| - _filePlaying = false;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::IsPlayingFileAsMicrophone() const
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::IsPlayingFileAsMicrophone()");
|
| - return _filePlaying;
|
| -}
|
| -
|
| -int TransmitMixer::StartRecordingMicrophone(const char* fileName,
|
| - const CodecInst* codecInst)
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StartRecordingMicrophone(fileName=%s)",
|
| - fileName);
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - if (_fileRecording)
|
| - {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "StartRecordingMicrophone() is already recording");
|
| - return 0;
|
| - }
|
| -
|
| - FileFormats format;
|
| - const uint32_t notificationTime(0); // Not supported in VoE
|
| - CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
| -
|
| - if (codecInst != NULL && codecInst->channels > 2)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingMicrophone() invalid compression");
|
| - return (-1);
|
| - }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| - } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| - {
|
| - format = kFileFormatWavFile;
|
| - } else
|
| - {
|
| - format = kFileFormatCompressedFile;
|
| - }
|
| -
|
| - // Destroy the old instance
|
| - if (file_recorder_) {
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_recorder_.reset();
|
| - }
|
| -
|
| - file_recorder_ = FileRecorder::CreateFileRecorder(
|
| - _fileRecorderId, (const FileFormats)format);
|
| - if (!file_recorder_) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_INVALID_ARGUMENT, kTraceError,
|
| - "StartRecordingMicrophone() fileRecorder format isnot correct");
|
| - return -1;
|
| - }
|
| -
|
| - if (file_recorder_->StartRecordingAudioFile(
|
| - fileName, (const CodecInst&)*codecInst, notificationTime) != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartRecordingAudioFile() failed to start file recording");
|
| - file_recorder_->StopRecording();
|
| - file_recorder_.reset();
|
| - return -1;
|
| - }
|
| - file_recorder_->RegisterModuleFileCallback(this);
|
| - _fileRecording = true;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::StartRecordingMicrophone(OutStream* stream,
|
| - const CodecInst* codecInst)
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StartRecordingMicrophone()");
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - if (_fileRecording)
|
| - {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "StartRecordingMicrophone() is already recording");
|
| - return 0;
|
| - }
|
| -
|
| - FileFormats format;
|
| - const uint32_t notificationTime(0); // Not supported in VoE
|
| - CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
| -
|
| - if (codecInst != NULL && codecInst->channels != 1)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingMicrophone() invalid compression");
|
| - return (-1);
|
| - }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| - } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| - {
|
| - format = kFileFormatWavFile;
|
| - } else
|
| - {
|
| - format = kFileFormatCompressedFile;
|
| - }
|
| -
|
| - // Destroy the old instance
|
| - if (file_recorder_) {
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_recorder_.reset();
|
| - }
|
| -
|
| - file_recorder_ = FileRecorder::CreateFileRecorder(
|
| - _fileRecorderId, (const FileFormats)format);
|
| - if (!file_recorder_) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_INVALID_ARGUMENT, kTraceError,
|
| - "StartRecordingMicrophone() fileRecorder format isnot correct");
|
| - return -1;
|
| - }
|
| -
|
| - if (file_recorder_->StartRecordingAudioFile(stream, *codecInst,
|
| - notificationTime) != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartRecordingAudioFile() failed to start file recording");
|
| - file_recorder_->StopRecording();
|
| - file_recorder_.reset();
|
| - return -1;
|
| - }
|
| -
|
| - file_recorder_->RegisterModuleFileCallback(this);
|
| - _fileRecording = true;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -
|
| -int TransmitMixer::StopRecordingMicrophone()
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StopRecordingMicrophone()");
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - if (!_fileRecording)
|
| - {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "StopRecordingMicrophone() isnot recording");
|
| - return 0;
|
| - }
|
| -
|
| - if (file_recorder_->StopRecording() != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_STOP_RECORDING_FAILED, kTraceError,
|
| - "StopRecording(), could not stop recording");
|
| - return -1;
|
| - }
|
| - file_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_recorder_.reset();
|
| - _fileRecording = false;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::StartRecordingCall(const char* fileName,
|
| - const CodecInst* codecInst)
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StartRecordingCall(fileName=%s)", fileName);
|
| -
|
| - if (_fileCallRecording)
|
| - {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "StartRecordingCall() is already recording");
|
| - return 0;
|
| - }
|
| -
|
| - FileFormats format;
|
| - const uint32_t notificationTime(0); // Not supported in VoE
|
| - CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
| -
|
| - if (codecInst != NULL && codecInst->channels != 1)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingCall() invalid compression");
|
| - return (-1);
|
| - }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| - } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| - {
|
| - format = kFileFormatWavFile;
|
| - } else
|
| - {
|
| - format = kFileFormatCompressedFile;
|
| - }
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - // Destroy the old instance
|
| - if (file_call_recorder_) {
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_call_recorder_.reset();
|
| - }
|
| -
|
| - file_call_recorder_ = FileRecorder::CreateFileRecorder(
|
| - _fileCallRecorderId, (const FileFormats)format);
|
| - if (!file_call_recorder_) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_INVALID_ARGUMENT, kTraceError,
|
| - "StartRecordingCall() fileRecorder format isnot correct");
|
| - return -1;
|
| - }
|
| -
|
| - if (file_call_recorder_->StartRecordingAudioFile(
|
| - fileName, (const CodecInst&)*codecInst, notificationTime) != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartRecordingAudioFile() failed to start file recording");
|
| - file_call_recorder_->StopRecording();
|
| - file_call_recorder_.reset();
|
| - return -1;
|
| - }
|
| - file_call_recorder_->RegisterModuleFileCallback(this);
|
| - _fileCallRecording = true;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::StartRecordingCall(OutStream* stream,
|
| - const CodecInst* codecInst)
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StartRecordingCall()");
|
| -
|
| - if (_fileCallRecording)
|
| - {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "StartRecordingCall() is already recording");
|
| - return 0;
|
| - }
|
| -
|
| - FileFormats format;
|
| - const uint32_t notificationTime(0); // Not supported in VoE
|
| - CodecInst dummyCodec = { 100, "L16", 16000, 320, 1, 320000 };
|
| -
|
| - if (codecInst != NULL && codecInst->channels != 1)
|
| - {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_ARGUMENT, kTraceError,
|
| - "StartRecordingCall() invalid compression");
|
| - return (-1);
|
| - }
|
| - if (codecInst == NULL)
|
| - {
|
| - format = kFileFormatPcm16kHzFile;
|
| - codecInst = &dummyCodec;
|
| - } else if ((STR_CASE_CMP(codecInst->plname,"L16") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMU") == 0) ||
|
| - (STR_CASE_CMP(codecInst->plname,"PCMA") == 0))
|
| - {
|
| - format = kFileFormatWavFile;
|
| - } else
|
| - {
|
| - format = kFileFormatCompressedFile;
|
| - }
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - // Destroy the old instance
|
| - if (file_call_recorder_) {
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_call_recorder_.reset();
|
| - }
|
| -
|
| - file_call_recorder_ = FileRecorder::CreateFileRecorder(
|
| - _fileCallRecorderId, (const FileFormats)format);
|
| - if (!file_call_recorder_) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_INVALID_ARGUMENT, kTraceError,
|
| - "StartRecordingCall() fileRecorder format isnot correct");
|
| - return -1;
|
| - }
|
| -
|
| - if (file_call_recorder_->StartRecordingAudioFile(stream, *codecInst,
|
| - notificationTime) != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_BAD_FILE, kTraceError,
|
| - "StartRecordingAudioFile() failed to start file recording");
|
| - file_call_recorder_->StopRecording();
|
| - file_call_recorder_.reset();
|
| - return -1;
|
| - }
|
| -
|
| - file_call_recorder_->RegisterModuleFileCallback(this);
|
| - _fileCallRecording = true;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int TransmitMixer::StopRecordingCall()
|
| -{
|
| - WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::StopRecordingCall()");
|
| -
|
| - if (!_fileCallRecording)
|
| - {
|
| - WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_instanceId, -1),
|
| - "StopRecordingCall() file isnot recording");
|
| - return -1;
|
| - }
|
| -
|
| - rtc::CritScope cs(&_critSect);
|
| -
|
| - if (file_call_recorder_->StopRecording() != 0) {
|
| - _engineStatisticsPtr->SetLastError(
|
| - VE_STOP_RECORDING_FAILED, kTraceError,
|
| - "StopRecording(), could not stop recording");
|
| - return -1;
|
| - }
|
| -
|
| - file_call_recorder_->RegisterModuleFileCallback(NULL);
|
| - file_call_recorder_.reset();
|
| - _fileCallRecording = false;
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -void
|
| -TransmitMixer::SetMixWithMicStatus(bool mix)
|
| -{
|
| - _mixFileWithMicrophone = mix;
|
| -}
|
| -
|
| int8_t TransmitMixer::AudioLevel() const
|
| {
|
| // Speech + file level [0,9]
|
| @@ -867,17 +269,6 @@ double TransmitMixer::GetTotalInputDuration() const {
|
| return _audioLevel.TotalDuration();
|
| }
|
|
|
| -bool TransmitMixer::IsRecordingCall()
|
| -{
|
| - return _fileCallRecording;
|
| -}
|
| -
|
| -bool TransmitMixer::IsRecordingMic()
|
| -{
|
| - rtc::CritScope cs(&_critSect);
|
| - return _fileRecording;
|
| -}
|
| -
|
| void TransmitMixer::GenerateAudioFrame(const int16_t* audio,
|
| size_t samples_per_channel,
|
| size_t num_channels,
|
| @@ -901,79 +292,6 @@ void TransmitMixer::GenerateAudioFrame(const int16_t* audio,
|
| &resampler_, &_audioFrame);
|
| }
|
|
|
| -int32_t TransmitMixer::RecordAudioToFile(
|
| - uint32_t mixingFrequency)
|
| -{
|
| - rtc::CritScope cs(&_critSect);
|
| - if (!file_recorder_) {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::RecordAudioToFile() filerecorder doesnot"
|
| - "exist");
|
| - return -1;
|
| - }
|
| -
|
| - if (file_recorder_->RecordAudioToFile(_audioFrame) != 0) {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::RecordAudioToFile() file recording"
|
| - "failed");
|
| - return -1;
|
| - }
|
| -
|
| - return 0;
|
| -}
|
| -
|
| -int32_t TransmitMixer::MixOrReplaceAudioWithFile(
|
| - int mixingFrequency)
|
| -{
|
| - std::unique_ptr<int16_t[]> fileBuffer(new int16_t[640]);
|
| -
|
| - size_t fileSamples(0);
|
| - {
|
| - rtc::CritScope cs(&_critSect);
|
| - if (!file_player_) {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::MixOrReplaceAudioWithFile()"
|
| - "fileplayer doesnot exist");
|
| - return -1;
|
| - }
|
| -
|
| - if (file_player_->Get10msAudioFromFile(fileBuffer.get(), &fileSamples,
|
| - mixingFrequency) == -1) {
|
| - WEBRTC_TRACE(kTraceWarning, kTraceVoice, VoEId(_instanceId, -1),
|
| - "TransmitMixer::MixOrReplaceAudioWithFile() file"
|
| - " mixing failed");
|
| - return -1;
|
| - }
|
| - }
|
| -
|
| - assert(_audioFrame.samples_per_channel_ == fileSamples);
|
| -
|
| - if (_mixFileWithMicrophone)
|
| - {
|
| - // Currently file stream is always mono.
|
| - // TODO(xians): Change the code when FilePlayer supports real stereo.
|
| - MixWithSat(_audioFrame.mutable_data(),
|
| - _audioFrame.num_channels_,
|
| - fileBuffer.get(),
|
| - 1,
|
| - fileSamples);
|
| - } else
|
| - {
|
| - // Replace ACM audio with file.
|
| - // Currently file stream is always mono.
|
| - // TODO(xians): Change the code when FilePlayer supports real stereo.
|
| - _audioFrame.UpdateFrame(-1,
|
| - 0xFFFFFFFF,
|
| - fileBuffer.get(),
|
| - fileSamples,
|
| - mixingFrequency,
|
| - AudioFrame::kNormalSpeech,
|
| - AudioFrame::kVadUnknown,
|
| - 1);
|
| - }
|
| - return 0;
|
| -}
|
| -
|
| void TransmitMixer::ProcessAudio(int delay_ms, int clock_drift,
|
| int current_mic_level, bool key_pressed) {
|
| if (audioproc_->set_stream_delay_ms(delay_ms) != 0) {
|
|
|