Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
mediastreamer2
Commits
4ed0a56a
Commit
4ed0a56a
authored
Jan 16, 2014
by
Sylvain Berfini
Browse files
Started opensles ms2 sound card for android
parent
cd4838bc
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
990 additions
and
1 deletion
+990
-1
build/android/Android.mk
build/android/Android.mk
+2
-1
java/src/org/linphone/mediastream/MediastreamerAndroidContext.java
...org/linphone/mediastream/MediastreamerAndroidContext.java
+57
-0
src/android/androidsound_opensles.cpp
src/android/androidsound_opensles.cpp
+931
-0
No files found.
build/android/Android.mk
View file @
4ed0a56a
...
...
@@ -92,6 +92,7 @@ LOCAL_SRC_FILES = \
audiofilters/devices.c
\
android/androidsound_depr.cpp
\
android/loader.cpp
\
android/androidsound_opensles.cpp
\
android/androidsound.cpp
\
android/AudioRecord.cpp
\
android/AudioTrack.cpp
\
...
...
@@ -289,7 +290,7 @@ ifeq ($(BUILD_MEDIASTREAMER2_SDK), 1)
LOCAL_SHARED_LIBRARIES
+=
libzrtpcpp
endif
LOCAL_LDLIBS
+=
-llog
-ldl
LOCAL_LDLIBS
+=
-lOpenSLES
-llog
-ldl
LOCAL_MODULE_FILENAME
:=
libmediastreamer2-
$(TARGET_ARCH_ABI)
include
$(BUILD_SHARED_LIBRARY)
else
...
...
java/src/org/linphone/mediastream/MediastreamerAndroidContext.java
0 → 100644
View file @
4ed0a56a
/*
AndroidContext.java
Copyright (C) 2014 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package
org.linphone.mediastream
;
import
android.annotation.TargetApi
;
import
android.content.Context
;
import
android.media.AudioManager
;
import
android.os.Build
;
@TargetApi
(
Build
.
VERSION_CODES
.
JELLY_BEAN_MR2
)
public
class
MediastreamerAndroidContext
{
private
native
void
setDeviceFavoriteSampleRate
(
int
samplerate
);
private
native
void
setDeviceFavoriteBufferSize
(
int
bufferSize
);
private
MediastreamerAndroidContext
()
{
}
public
static
void
setContext
(
Object
c
)
{
if
(
c
==
null
)
return
;
Context
context
=
(
Context
)
c
;
int
bufferSize
=
64
;
int
sampleRate
=
44100
;
MediastreamerAndroidContext
mac
=
new
MediastreamerAndroidContext
();
// When using the OpenSLES sound card, the system is capable of giving us the best values to use for the buffer size and the sample rate
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
AudioManager
audiomanager
=
(
AudioManager
)
context
.
getSystemService
(
Context
.
AUDIO_SERVICE
);
bufferSize
=
Integer
.
getInteger
(
audiomanager
.
getProperty
(
AudioManager
.
PROPERTY_OUTPUT_FRAMES_PER_BUFFER
),
bufferSize
);
sampleRate
=
Integer
.
getInteger
(
audiomanager
.
getProperty
(
AudioManager
.
PROPERTY_OUTPUT_SAMPLE_RATE
),
sampleRate
);
Log
.
i
(
"Setting buffer size to "
+
bufferSize
+
" and sample rate to "
+
sampleRate
+
" for OpenSLES MS sound card."
);
mac
.
setDeviceFavoriteSampleRate
(
sampleRate
);
mac
.
setDeviceFavoriteBufferSize
(
bufferSize
);
}
else
{
Log
.
i
(
"Android < 4.4 detected, android context not used."
);
}
}
}
src/android/androidsound_opensles.cpp
0 → 100644
View file @
4ed0a56a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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