Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
f1b2fd9b
Commit
f1b2fd9b
authored
Jan 27, 2009
by
alexandresavard
Browse files
Recording now in audiortp::run() method
parent
f62a68a8
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/audio/audiortp.cpp
View file @
f1b2fd9b
...
...
@@ -269,6 +269,10 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
//_debug("get data from mic\n");
int
nbSample
=
audiolayer
->
getMic
(
micData
,
bytesAvail
)
/
sizeof
(
SFLDataFormat
);
int
nb_sample_up
=
nbSample
;
// Store the length of the mic buffer in samples for recording
_nSamplesMic
=
nbSample
;
int
nbSamplesMax
=
_layerFrameSize
*
_audiocodec
->
getClockRate
()
/
1000
;
//_debug("resample data\n");
...
...
@@ -349,9 +353,9 @@ AudioRtpRTX::receiveSessionForSpkr (int& countTime)
#ifdef DATAFORMAT_IS_FLOAT
#else
#endif
//
Record before sending to audio
recAudio
.
recData
(
spkrDataConverted
,
nbSample
)
;
//
Stor the number of samples for recording
_nSamplesSpkr
=
nbSample
;
audiolayer
->
playSamples
(
spkrDataConverted
,
nbSample
*
sizeof
(
SFLDataFormat
),
true
);
...
...
@@ -432,6 +436,9 @@ AudioRtpRTX::run () {
////////////////////////////
receiveSessionForSpkr
(
countTime
);
// Let's wait for the next transmit cycle
recAudio
.
recData
(
spkrDataConverted
,
_nSamplesSpkr
);
Thread
::
sleep
(
TimerPort
::
getTimer
());
TimerPort
::
incTimer
(
_layerFrameSize
);
// 'frameSize' ms
}
...
...
src/audio/audiortp.h
View file @
f1b2fd9b
...
...
@@ -40,7 +40,6 @@
* @brief Manage the real-time data transport in a SIP call
*/
typedef
unsigned
char
*
samplePtr
;
class
SIPCall
;
...
...
@@ -119,6 +118,18 @@ class AudioRtpRTX : public ost::Thread, public ost::TimerPort {
/** Length of the sound frame we capture in ms(typically 20ms) */
int
_layerFrameSize
;
/** Speaker buffer length in samples once the data are resampled
* (used for mixing and recording)
*/
int
_nSamplesSpkr
;
/** Mic buffer length in samples once the data are resampled
* (used for mixing and recording)
*/
int
_nSamplesMic
;
/**
* Init the RTP session. Create either symmetric or double sessions to manage data transport
* Set the payloads according to the manager preferences
...
...
src/audio/pulselayer.cpp
View file @
f1b2fd9b
...
...
@@ -93,10 +93,6 @@ PulseLayer::connectPulseAudioServer( void )
//muteAudioApps(99);
_debug
(
"Context creation done
\n
"
);
//FILE_TYPE ft = FILE_WAV;
//SOUND_FORMAT sf = INT16;
//audioRec.setSndSamplingRate(44100);
//audioRec.openFile("SFLWavFile.wav",ft,sf);
}
void
PulseLayer
::
context_state_callback
(
pa_context
*
c
,
void
*
user_data
)
...
...
@@ -249,12 +245,6 @@ PulseLayer::startStream (void)
pa_stream_cork
(
record
->
pulseStream
(),
NULL
,
NULL
,
NULL
);
pa_threaded_mainloop_unlock
(
m
);
_debug
(
"Opening the wave file
\n
"
);
FILE_TYPE
ft
=
FILE_WAV
;
SOUND_FORMAT
sf
=
INT16
;
audioRec
.
setSndSamplingRate
(
44100
);
audioRec
.
openFile
(
"SFLWavFile.wav"
,
ft
,
sf
);
}
void
...
...
@@ -264,9 +254,6 @@ PulseLayer::stopStream (void)
pa_stream_flush
(
playback
->
pulseStream
(),
NULL
,
NULL
);
pa_stream_flush
(
record
->
pulseStream
(),
NULL
,
NULL
);
flushMic
();
_debug
(
"Closing the wav file
\n
"
);
audioRec
.
closeFile
();
}
...
...
@@ -305,7 +292,8 @@ PulseLayer::processData( void )
}
}
void
PulseLayer
::
writeToSpeaker
(
void
)
void
PulseLayer
::
writeToSpeaker
(
void
)
{
/** Bytes available in the urgent ringbuffer ( reserved for DTMF ) */
int
urgentAvail
;
...
...
src/audio/pulselayer.h
View file @
f1b2fd9b
...
...
@@ -22,7 +22,6 @@
#include
"audiolayer.h"
#include
"audiostream.h"
#include
"plug-in/audiorecorder/audiorecord.h"
#define PLAYBACK_STREAM_NAME "SFLphone out"
#define CAPTURE_STREAM_NAME "SFLphone in"
...
...
@@ -256,10 +255,6 @@ class PulseLayer : public AudioLayer {
int
spkrVolume
;
int
micVolume
;
/**
* Audio device to record audio streams on disk
*/
AudioRecord
audioRec
;
public:
static
int
streamState
;
...
...
src/audio/ringbuffer.cpp
View file @
f1b2fd9b
...
...
@@ -82,7 +82,8 @@ RingBuffer::Put(void* buffer, int toCopy, unsigned short volume) {
toCopy
=
(
mBufferSize
-
4
)
-
len
;
src
=
(
samplePtr
)
buffer
;
copied
=
0
;
pos
=
mEnd
;
...
...
src/plug-in/audiorecorder/audiorecord.cpp
View file @
f1b2fd9b
...
...
@@ -163,7 +163,7 @@ void AudioRecord::recData(SFLDataFormat* buffer, int nSamples) {
// printf("AudioRecord : buffer: %x : ", buffer);
if
(
sndFormat_
==
INT16
)
{
// TODO change INT16 to SINT16
if
(
fwrite
(
buffer
,
nSamples
*
sizeof
(
SFLDataFormat
),
1
,
fp
)
!=
1
)
if
(
fwrite
(
buffer
,
sizeof
(
SFLDataFormat
),
nSamples
,
fp
)
!=
nSamples
)
_debug
(
"AudioRecord: Could not record data!
\n
"
);
else
{
// printf("Buffer : %x \n",*buffer);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment