Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
f1b0f902
Commit
f1b0f902
authored
Sep 4, 2006
by
yanmorin
Browse files
Options
Downloads
Patches
Plain Diff
Adding timestamp just before sending microphone sound (rtp)
parent
85019ee5
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/audio/audiortp.cpp
+22
-1
22 additions, 1 deletion
src/audio/audiortp.cpp
src/audio/ringbuffer.cpp
+4
-2
4 additions, 2 deletions
src/audio/ringbuffer.cpp
with
26 additions
and
3 deletions
src/audio/audiortp.cpp
+
22
−
1
View file @
f1b0f902
...
@@ -260,6 +260,23 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
...
@@ -260,6 +260,23 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
SRC_DATA
src_data
;
SRC_DATA
src_data
;
#ifdef DATAFORMAT_IS_FLOAT
#ifdef DATAFORMAT_IS_FLOAT
src_data
.
data_in
=
_dataAudioLayer
;
src_data
.
data_in
=
_dataAudioLayer
;
/* _debug("inb: %d %f %f %f %f %f %f %f %f %f %f %f %f\n", nbSample, _dataAudioLayer[0],
_dataAudioLayer[1 ],
_dataAudioLayer[2 ],
_dataAudioLayer[3 ],
_dataAudioLayer[4 ],
_dataAudioLayer[5 ],
_dataAudioLayer[6 ],
_dataAudioLayer[7 ],
_dataAudioLayer[8 ],
_dataAudioLayer[9 ],
_dataAudioLayer[10],
_dataAudioLayer[11],
_dataAudioLayer[12],
_dataAudioLayer[13],
_dataAudioLayer[14],
_dataAudioLayer[15]
);*/
#else
#else
src_short_to_float_array
(
_dataAudioLayer
,
_floatBuffer48000
,
nbSample
);
src_short_to_float_array
(
_dataAudioLayer
,
_floatBuffer48000
,
nbSample
);
src_data
.
data_in
=
_floatBuffer48000
;
src_data
.
data_in
=
_floatBuffer48000
;
...
@@ -272,6 +289,9 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
...
@@ -272,6 +289,9 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
src_simple
(
&
src_data
,
SRC_SINC_BEST_QUALITY
/*SRC_SINC_MEDIUM_QUALITY*/
,
1
);
// 1 = channel
src_simple
(
&
src_data
,
SRC_SINC_BEST_QUALITY
/*SRC_SINC_MEDIUM_QUALITY*/
,
1
);
// 1 = channel
nbSample
=
src_data
.
output_frames_gen
;
nbSample
=
src_data
.
output_frames_gen
;
//if (nbSample > RTP_20S_8KHZ_MAX) { _debug("Alert from mic, nbSample %d is bigger than expected %d\n", nbSample, RTP_20S_8KHZ_MAX); }
//if (nbSample > RTP_20S_8KHZ_MAX) { _debug("Alert from mic, nbSample %d is bigger than expected %d\n", nbSample, RTP_20S_8KHZ_MAX); }
/*_debug("ina: %d %f %f\n", nbSample, _floatBuffer8000[0],
_floatBuffer8000[1 ]
);*/
src_float_to_short_array
(
_floatBuffer8000
,
_intBuffer8000
,
nbSample
);
src_float_to_short_array
(
_floatBuffer8000
,
_intBuffer8000
,
nbSample
);
toSIP
=
_intBuffer8000
;
toSIP
=
_intBuffer8000
;
}
else
{
}
else
{
...
@@ -285,7 +305,7 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
...
@@ -285,7 +305,7 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
#endif
#endif
}
}
if
(
nbSample
<
RTP_20S_8KHZ_MAX
)
{
if
(
nbSample
<
(
RTP_20S_8KHZ_MAX
-
10
)
)
{
// if only 10 is missing, it's ok
// fill end with 0...
// fill end with 0...
//_debug("begin: %p, nbSample: %d\n", toSIP, nbSample);
//_debug("begin: %p, nbSample: %d\n", toSIP, nbSample);
//_debug("has to fill: %d chars at %p\n", (RTP_20S_8KHZ_MAX-nbSample)*sizeof(int16), toSIP + nbSample);
//_debug("has to fill: %d chars at %p\n", (RTP_20S_8KHZ_MAX-nbSample)*sizeof(int16), toSIP + nbSample);
...
@@ -301,6 +321,7 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
...
@@ -301,6 +321,7 @@ AudioRtpRTX::sendSessionFromMic(int timestamp)
// encode divise by two
// encode divise by two
// Send encoded audio sample over the network
// Send encoded audio sample over the network
if
(
compSize
>
RTP_20S_8KHZ_MAX
)
{
_debug
(
"! ARTP: %d should be %d
\n
"
,
compSize
,
RTP_20S_8KHZ_MAX
);}
if
(
compSize
>
RTP_20S_8KHZ_MAX
)
{
_debug
(
"! ARTP: %d should be %d
\n
"
,
compSize
,
RTP_20S_8KHZ_MAX
);}
timestamp
+=
time
->
getSecond
();
if
(
!
_sym
)
{
if
(
!
_sym
)
{
_sessionSend
->
putData
(
timestamp
,
_sendDataEncoded
,
compSize
);
_sessionSend
->
putData
(
timestamp
,
_sendDataEncoded
,
compSize
);
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/audio/ringbuffer.cpp
+
4
−
2
View file @
f1b0f902
...
@@ -87,8 +87,9 @@ RingBuffer::Put(void* buffer, int toCopy, unsigned short volume) {
...
@@ -87,8 +87,9 @@ RingBuffer::Put(void* buffer, int toCopy, unsigned short volume) {
//fprintf(stderr, "P");
//fprintf(stderr, "P");
while
(
toCopy
)
{
while
(
toCopy
)
{
block
=
toCopy
;
block
=
toCopy
;
if
(
block
>
(
mBufferSize
-
pos
))
// from current pos. to end of buffer
if
(
block
>
(
mBufferSize
-
pos
))
{
// from current pos. to end of buffer
block
=
mBufferSize
-
pos
;
block
=
mBufferSize
-
pos
;
}
// put the data inside the buffer.
// put the data inside the buffer.
if
(
volume
!=
100
)
{
if
(
volume
!=
100
)
{
...
@@ -138,8 +139,9 @@ RingBuffer::Get(void *buffer, int toCopy, unsigned short volume) {
...
@@ -138,8 +139,9 @@ RingBuffer::Get(void *buffer, int toCopy, unsigned short volume) {
//fprintf(stderr, "G");
//fprintf(stderr, "G");
while
(
toCopy
)
{
while
(
toCopy
)
{
block
=
toCopy
;
block
=
toCopy
;
if
(
block
>
(
mBufferSize
-
mStart
))
if
(
block
>
(
mBufferSize
-
mStart
))
{
block
=
mBufferSize
-
mStart
;
block
=
mBufferSize
-
mStart
;
}
if
(
volume
!=
100
)
{
if
(
volume
!=
100
)
{
SFLDataFormat
*
start
=
(
SFLDataFormat
*
)(
mBuffer
+
mStart
);
SFLDataFormat
*
start
=
(
SFLDataFormat
*
)(
mBuffer
+
mStart
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
sign in
to comment