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
7f71f3ac
Commit
7f71f3ac
authored
16 years ago
by
Emmanuel Milou
Browse files
Options
Downloads
Patches
Plain Diff
warning removed
parent
a420faba
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/audio/alsalayer.cpp
+3
-25
3 additions, 25 deletions
src/audio/alsalayer.cpp
src/iaxvoiplink.cpp
+9
-8
9 additions, 8 deletions
src/iaxvoiplink.cpp
with
12 additions
and
33 deletions
src/audio/alsalayer.cpp
+
3
−
25
View file @
7f71f3ac
...
...
@@ -134,28 +134,7 @@ void AlsaLayer::AlsaCallBack( snd_async_handler_t* pcm_callback )
void
AlsaLayer
::
fillHWBuffer
(
void
)
{
unsigned
char
*
data
;
int
pcmreturn
,
l1
,
l2
;
short
s1
,
s2
;
int
periodSize
=
128
;
int
frames
=
periodSize
>>
2
;
_debug
(
"frames = %d
\n
"
,
frames
);
data
=
(
unsigned
char
*
)
malloc
(
periodSize
);
for
(
l1
=
0
;
l1
<
100
;
l1
++
)
{
for
(
l2
=
0
;
l2
<
frames
;
l2
++
)
{
s1
=
0
;
s2
=
0
;
data
[
4
*
l2
]
=
(
unsigned
char
)
s1
;
data
[
4
*
l2
+
1
]
=
s1
>>
8
;
data
[
4
*
l2
+
2
]
=
(
unsigned
char
)
s2
;
data
[
4
*
l2
+
3
]
=
s2
>>
8
;
}
while
((
pcmreturn
=
snd_pcm_writei
(
_PlaybackHandle
,
data
,
frames
))
<
0
)
{
snd_pcm_prepare
(
_PlaybackHandle
);
//_debugAlsa("< Buffer Underrun >\n");
}
}
}
bool
...
...
@@ -165,7 +144,6 @@ AlsaLayer::isStreamActive (void)
return
(
isPlaybackActive
()
&&
isCaptureActive
());
}
int
AlsaLayer
::
playSamples
(
void
*
buffer
,
int
toCopy
,
bool
isTalking
)
{
...
...
@@ -199,7 +177,7 @@ AlsaLayer::canGetMic()
int
avail
;
if
(
_CaptureHandle
)
{
avail
=
snd_pcm_avail_update
(
_CaptureHandle
);
//
printf("%d\n", avail );
printf
(
"%d
\n
"
,
avail
);
if
(
avail
>
0
)
return
avail
;
else
...
...
@@ -339,7 +317,7 @@ bool AlsaLayer::alsa_set_params( snd_pcm_t *pcm_handle, int type, int rate ){
return
false
;
}
if
(
dir
!=
0
)
{
_debugAlsa
(
"(%i) The choosen period size %d bytes is not supported by your hardware.
\n
Using %d instead.
\n
"
,
type
,
periodsize
,
exact_lvalue
);
_debugAlsa
(
"(%i) The choosen period size %d bytes is not supported by your hardware.
\n
Using %d instead.
\n
"
,
type
,
(
int
)
periodsize
,
(
int
)
exact_lvalue
);
}
periodsize
=
exact_lvalue
;
/* Set the number of fragments */
...
...
This diff is collapsed.
Click to expand it.
src/iaxvoiplink.cpp
+
9
−
8
View file @
7f71f3ac
...
...
@@ -219,6 +219,10 @@ IAXVoIPLink::sendAudioFromMic(void)
int
maxBytesToGet
,
availBytesFromMic
,
bytesAvail
,
nbSample
,
compSize
;
AudioCodec
*
ac
;
// We have to update the audio layer type in case we switched
// TODO Find out a better way to do it
updateAudiolayer
();
IAXCall
*
currentCall
=
getIAXCall
(
Manager
::
instance
().
getCurrentCallId
());
if
(
!
currentCall
)
{
...
...
@@ -231,15 +235,15 @@ IAXVoIPLink::sendAudioFromMic(void)
// Just make sure the currentCall is in state to receive audio right now.
//_debug("Here we get: connectionState: %d state: %d \n",
//
currentCall->getConnectionState(),
//
currentCall->getState());
//currentCall->getConnectionState(),
//currentCall->getState());
if
(
currentCall
->
getConnectionState
()
!=
Call
::
Connected
||
currentCall
->
getState
()
!=
Call
::
Active
)
{
return
;
}
ac
=
currentCall
->
getCodecMap
().
getCodec
(
currentCall
->
getAudioCodec
()
);
ac
=
currentCall
->
getCodecMap
().
getCodec
(
currentCall
->
getAudioCodec
()
);
if
(
!
ac
)
{
// Audio codec still not determined.
if
(
audiolayer
)
{
...
...
@@ -255,14 +259,11 @@ IAXVoIPLink::sendAudioFromMic(void)
// we have to get 20ms of data from the mic *20/1000 = /50
// rate/50 shall be lower than IAX__20S_48KHZ_MAX
maxBytesToGet
=
audiolayer
->
getSampleRate
()
*
audiolayer
->
getFrameSize
()
/
1000
*
sizeof
(
SFLDataFormat
);
// We have to update the audio layer type in case we switched
// TODO Find out a better way to do it
updateAudiolayer
();
// available bytes inside ringbuffer
availBytesFromMic
=
audiolayer
->
canGetMic
();
_debug
(
"max bytes=%i - avail = %i
\n
"
,
maxBytesToGet
,
availBytesFromMic
);
if
(
availBytesFromMic
<
maxBytesToGet
)
{
// We need packets full!
...
...
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