Skip to content
Snippets Groups Projects
Commit a7bed668 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2209] Fix recording in regard of resamling

parent 6a14e843
Branches
Tags
No related merge requests found
...@@ -497,6 +497,8 @@ namespace sfl { ...@@ -497,6 +497,8 @@ namespace sfl {
throw AudioRtpSessionException(); throw AudioRtpSessionException();
} }
_ca->setRecordingSmplRate(_audiocodec->getClockRate());
_audiolayer->startStream(); _audiolayer->startStream();
static_cast<D*>(this)->startRunning(); static_cast<D*>(this)->startRunning();
...@@ -518,7 +520,7 @@ namespace sfl { ...@@ -518,7 +520,7 @@ namespace sfl {
// Let's wait for the next transmit cycle // Let's wait for the next transmit cycle
if (sessionWaiting == 1) { if (sessionWaiting == 1) {
// Record mic and speaker during conversation // Record mic and speaker during conversation
_ca->recAudio.recData (_spkrDataConverted, _micData, _nSamplesSpkr, _nSamplesMic); _ca->recAudio.recData (_spkrDataDecoded, _micData, _nSamplesSpkr, _nSamplesMic);
} else { } else {
// Record mic only while leaving a message // Record mic only while leaving a message
_ca->recAudio.recData (_micData,_nSamplesMic); _ca->recAudio.recData (_micData,_nSamplesMic);
......
...@@ -25,7 +25,7 @@ Recordable::Recordable() ...@@ -25,7 +25,7 @@ Recordable::Recordable()
FILE_TYPE fileType = FILE_WAV; FILE_TYPE fileType = FILE_WAV;
SOUND_FORMAT soundFormat = INT16; SOUND_FORMAT soundFormat = INT16;
recAudio.setRecordingOption (fileType, soundFormat, 44100, Manager::instance().getConfigString (AUDIO, RECORD_PATH)); recAudio.setRecordingOption (fileType, soundFormat, 8000, Manager::instance().getConfigString (AUDIO, RECORD_PATH));
} }
...@@ -42,3 +42,11 @@ void Recordable::initRecFileName() ...@@ -42,3 +42,11 @@ void Recordable::initRecFileName()
recAudio.initFileName (getRecFileId()); recAudio.initFileName (getRecFileId());
} }
void Recordable::setRecordingSmplRate(int smplRate)
{
recAudio.setSndSamplingRate(smplRate);
}
...@@ -37,6 +37,8 @@ class Recordable { ...@@ -37,6 +37,8 @@ class Recordable {
void initRecFileName(); void initRecFileName();
void setRecordingSmplRate(int smplRate);
virtual std::string getRecFileId() = 0; virtual std::string getRecFileId() = 0;
// virtual std::string getFileName() = 0; // virtual std::string getFileName() = 0;
......
...@@ -41,7 +41,7 @@ struct wavhdr { ...@@ -41,7 +41,7 @@ struct wavhdr {
AudioRecord::AudioRecord() AudioRecord::AudioRecord()
{ {
sndSmplRate_ = 44100; sndSmplRate_ = 8000;
channels_ = 1; channels_ = 1;
byteCounter_ = 0; byteCounter_ = 0;
recordingEnabled_ = false; recordingEnabled_ = false;
...@@ -305,7 +305,7 @@ bool AudioRecord::setWavFile() ...@@ -305,7 +305,7 @@ bool AudioRecord::setWavFile()
} }
struct wavhdr hdr = {"RIF", 44, "WAV", "fmt", 16, 1, 1, struct wavhdr hdr = {"RIF", 44, "WAV", "fmt", 16, 1, 1,
44100, 0, 2, 16, "dat", 0 sndSmplRate_, 0, 2, 16, "dat", 0
}; };
hdr.riff[3] = 'F'; hdr.riff[3] = 'F';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment