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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
2a9f1bd3
Commit
2a9f1bd3
authored
13 years ago
by
Rafaël Carré
Browse files
Options
Downloads
Patches
Plain Diff
MainBuffer: simplify
Do not export buffer size, it's internal only
parent
fa70e0e9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
sflphone-common/src/audio/mainbuffer.cpp
+16
-56
16 additions, 56 deletions
sflphone-common/src/audio/mainbuffer.cpp
sflphone-common/src/audio/mainbuffer.h
+1
-3
1 addition, 3 deletions
sflphone-common/src/audio/mainbuffer.h
sflphone-common/src/global.h
+0
-1
0 additions, 1 deletion
sflphone-common/src/global.h
with
17 additions
and
60 deletions
sflphone-common/src/audio/mainbuffer.cpp
+
16
−
56
View file @
2a9f1bd3
...
...
@@ -35,81 +35,49 @@
MainBuffer
::
MainBuffer
()
:
_internalSamplingRate
(
8000
)
{
mixBuffer
=
new
SFLDataFormat
[
STATIC_BUFSIZE
];
}
MainBuffer
::~
MainBuffer
()
{
delete
[]
mixBuffer
;
mixBuffer
=
NULL
;
}
void
MainBuffer
::
setInternalSamplingRate
(
int
sr
)
{
_debug
(
"MainBuffer: Set internal sampling rate"
);
if
(
sr
>
_internalSamplingRate
)
{
_debug
(
"MainBuffer: Internal sampling rate changed %d"
,
sr
);
// This call takes the mutex
flushAllBuffers
();
// ost::MutexLock guard (_mutex);
_internalSamplingRate
=
sr
;
// Manager::instance().audioSamplingRateChanged(sr);
}
}
CallIDSet
*
MainBuffer
::
getCallIDSet
(
std
::
string
call_id
)
{
CallIDMap
::
iterator
iter
=
_callIDMap
.
find
(
call_id
);
if
(
iter
!=
_callIDMap
.
end
())
return
iter
->
second
;
else
return
NULL
;
return
(
iter
!=
_callIDMap
.
end
())
?
iter
->
second
:
NULL
;
}
bool
MainBuffer
::
createCallIDSet
(
std
::
string
set_id
)
void
MainBuffer
::
createCallIDSet
(
std
::
string
set_id
)
{
CallIDSet
*
newCallIDSet
=
new
CallIDSet
;
_callIDMap
.
insert
(
std
::
pair
<
std
::
string
,
CallIDSet
*>
(
set_id
,
new
CallIDSet
));
return
true
;
}
bool
MainBuffer
::
removeCallIDSet
(
std
::
string
set_id
)
{
CallIDSet
*
callid_set
=
getCallIDSet
(
set_id
);
if
(
callid_set
!=
NULL
)
{
if
(
_callIDMap
.
erase
(
set_id
)
!=
0
)
{
delete
callid_set
;
callid_set
=
NULL
;
return
true
;
}
else
{
_debug
(
"removeCallIDSet error while removing callid set %s!"
,
set_id
.
c_str
());
return
false
;
}
}
else
{
if
(
!
callid_set
)
{
_debug
(
"removeCallIDSet error callid set %s does not exist!"
,
set_id
.
c_str
());
return
false
;
}
if
(
_callIDMap
.
erase
(
set_id
)
==
0
)
{
_debug
(
"removeCallIDSet error while removing callid set %s!"
,
set_id
.
c_str
());
return
false
;
}
delete
callid_set
;
callid_set
=
NULL
;
return
true
;
}
void
MainBuffer
::
addCallIDtoSet
(
std
::
string
set_id
,
std
::
string
call_id
)
...
...
@@ -148,9 +116,7 @@ RingBuffer* MainBuffer::getRingBuffer (std::string call_id)
RingBuffer
*
MainBuffer
::
createRingBuffer
(
std
::
string
call_id
)
{
RingBuffer
*
newRingBuffer
=
new
RingBuffer
(
SIZEBUF
,
call_id
);
_ringBufferMap
.
insert
(
std
::
pair
<
std
::
string
,
RingBuffer
*>
(
call_id
,
newRingBuffer
));
return
newRingBuffer
;
}
...
...
@@ -378,12 +344,7 @@ int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, std::s
CallIDSet
*
callid_set
=
getCallIDSet
(
call_id
);
int
nbSmplToCopy
=
toCopy
/
sizeof
(
SFLDataFormat
);
if
(
callid_set
==
NULL
)
return
0
;
if
(
callid_set
->
empty
())
{
if
(
!
callid_set
||
callid_set
->
empty
())
{
return
0
;
}
...
...
@@ -396,18 +357,17 @@ int MainBuffer::getData (void *buffer, int toCopy, unsigned short volume, std::s
}
else
return
0
;
}
else
{
memset
(
buffer
,
0
,
nbSmplToCopy
*
sizeof
(
SFLDataFormat
));
memset
(
buffer
,
0
,
toCopy
);
int
size
=
0
;
CallIDSet
::
iterator
iter_id
=
callid_set
->
begin
();
while
(
iter_id
!=
callid_set
->
end
())
{
int
nbSmplToCopy
=
toCopy
/
sizeof
(
SFLDataFormat
);
SFLDataFormat
mixBuffer
[
nbSmplToCopy
];
memset
(
mixBuffer
,
0
,
toCopy
);
size
=
getDataByID
(
mixBuffer
,
toCopy
,
volume
,
(
std
::
string
)
(
*
iter_id
),
call_id
);
size
=
getDataByID
(
mixBuffer
,
toCopy
,
volume
,
*
iter_id
,
call_id
);
if
(
size
>
0
)
{
for
(
int
k
=
0
;
k
<
nbSmplToCopy
;
k
++
)
{
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/mainbuffer.h
+
1
−
3
View file @
2a9f1bd3
...
...
@@ -113,7 +113,7 @@ class MainBuffer
CallIDSet
*
getCallIDSet
(
std
::
string
call_id
);
bool
createCallIDSet
(
std
::
string
set_id
);
void
createCallIDSet
(
std
::
string
set_id
);
bool
removeCallIDSet
(
std
::
string
set_id
);
...
...
@@ -145,8 +145,6 @@ class MainBuffer
CallIDMap
_callIDMap
;
SFLDataFormat
*
mixBuffer
;
ost
::
Mutex
_mutex
;
int
_internalSamplingRate
;
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/global.h
+
0
−
1
View file @
2a9f1bd3
...
...
@@ -83,7 +83,6 @@ static const SOUND_FORMAT INT32 = 0x8;
#define CODECDIR "codecs"
/** Codecs directory */
#define SIZEBUF 400000
/** About 12 sec of buffering at 8000 Hz*/
#define STATIC_BUFSIZE 5000
#define ALSA_DFT_CARD_ID 0
/** Index of the default soundcard */
...
...
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
register
or
sign in
to comment