Skip to content

Commit

Permalink
Merge tag 'android-4.3_r2.1' into cm-10.2
Browse files Browse the repository at this point in the history
Android 4.3 release 2.1
  • Loading branch information
rmcc committed Jul 24, 2013
2 parents 4a4c728 + 3f73d41 commit 073b588
Show file tree
Hide file tree
Showing 16 changed files with 135 additions and 66 deletions.
2 changes: 1 addition & 1 deletion src/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ LOCAL_STATIC_LIBRARIES += \
libOpenSLESUT

LOCAL_SHARED_LIBRARIES := \
liblog \
libutils \
libmedia \
libmedia_native \
libbinder \
libstagefright \
libstagefright_foundation \
Expand Down
24 changes: 0 additions & 24 deletions src/android/AudioPlayer_to_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,30 +163,6 @@ static size_t adecoder_writeToBufferQueue(const uint8_t *data, size_t size, CAud
return sizeConsumed;
}

//-----------------------------------------------------------------------------
int android_getMinFrameCount(uint32_t sampleRate) {
int afSampleRate;
if (android::AudioSystem::getOutputSamplingRate(&afSampleRate,
ANDROID_DEFAULT_OUTPUT_STREAM_TYPE) != android::NO_ERROR) {
return ANDROID_DEFAULT_AUDIOTRACK_BUFFER_SIZE;
}
int afFrameCount;
if (android::AudioSystem::getOutputFrameCount(&afFrameCount,
ANDROID_DEFAULT_OUTPUT_STREAM_TYPE) != android::NO_ERROR) {
return ANDROID_DEFAULT_AUDIOTRACK_BUFFER_SIZE;
}
uint32_t afLatency;
if (android::AudioSystem::getOutputLatency(&afLatency,
ANDROID_DEFAULT_OUTPUT_STREAM_TYPE) != android::NO_ERROR) {
return ANDROID_DEFAULT_AUDIOTRACK_BUFFER_SIZE;
}
// minimum nb of buffers to cover output latency, given the size of each hardware audio buffer
uint32_t minBufCount = afLatency / ((1000 * afFrameCount)/afSampleRate);
if (minBufCount < 2) minBufCount = 2;
// minimum number of frames to cover output latency at the sample rate of the content
return (afFrameCount*sampleRate*minBufCount)/afSampleRate;
}


//-----------------------------------------------------------------------------
#define LEFT_CHANNEL_MASK 0x1 << 0
Expand Down
16 changes: 4 additions & 12 deletions src/android/MediaPlayer_to_android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -738,20 +738,12 @@ SLresult android_Player_setNativeWindow(CMediaPlayer *mp, ANativeWindow *nativeW
result = SL_RESULT_PARAMETER_INVALID;
} else {
switch (value) {
case NATIVE_WINDOW_SURFACE: { // Surface
case NATIVE_WINDOW_SURFACE: { // Surface
SL_LOGV("Displaying on ANativeWindow of type NATIVE_WINDOW_SURFACE");
android::sp<android::Surface> nativeSurface(
android::sp<android::Surface> surface(
static_cast<android::Surface *>(nativeWindow));
mp->mAVPlayer->setVideoSurfaceTexture(
nativeSurface->getSurfaceTexture());
result = SL_RESULT_SUCCESS;
} break;
case NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT: { // SurfaceTextureClient
SL_LOGV("Displaying on ANativeWindow of type NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT");
android::sp<android::SurfaceTextureClient> surfaceTextureClient(
static_cast<android::SurfaceTextureClient *>(nativeWindow));
android::sp<android::ISurfaceTexture> nativeSurfaceTexture(
surfaceTextureClient->getISurfaceTexture());
android::sp<android::IGraphicBufferProducer> nativeSurfaceTexture(
surface->getIGraphicBufferProducer());
mp->mAVPlayer->setVideoSurfaceTexture(nativeSurfaceTexture);
result = SL_RESULT_SUCCESS;
} break;
Expand Down
8 changes: 4 additions & 4 deletions src/android/android_GenericMediaPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@ void GenericMediaPlayer::getPositionMsec(int* msec) {
}

//--------------------------------------------------
void GenericMediaPlayer::setVideoSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {
void GenericMediaPlayer::setVideoSurfaceTexture(const sp<IGraphicBufferProducer> &bufferProducer) {
SL_LOGV("GenericMediaPlayer::setVideoSurfaceTexture()");
// FIXME bug - race condition, should do in looper
if (mVideoSurfaceTexture.get() == surfaceTexture.get()) {
if (mVideoSurfaceTexture.get() == bufferProducer.get()) {
return;
}
if ((mStateFlags & kFlagPrepared) && (mPlayer != 0)) {
mPlayer->setVideoSurfaceTexture(surfaceTexture);
mPlayer->setVideoSurfaceTexture(bufferProducer);
}
mVideoSurfaceTexture = surfaceTexture;
mVideoSurfaceTexture = bufferProducer;
}

//--------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/android/android_GenericMediaPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "android_GenericPlayer.h"

#include <binder/IServiceManager.h>
#include <gui/ISurfaceTexture.h>
#include <gui/IGraphicBufferProducer.h>


//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -89,7 +89,7 @@ class GenericMediaPlayer : public GenericPlayer
// overridden from GenericPlayer
virtual void getPositionMsec(int* msec); // ANDROID_UNKNOWN_TIME if unknown

virtual void setVideoSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture);
virtual void setVideoSurfaceTexture(const sp<IGraphicBufferProducer> &bufferProducer);

virtual void setPlaybackRate(int32_t ratePermille);

Expand All @@ -111,7 +111,7 @@ class GenericMediaPlayer : public GenericPlayer
const bool mHasVideo; // const allows MediaPlayerNotificationClient::notify to safely access
int32_t mSeekTimeMsec;

sp<ISurfaceTexture> mVideoSurfaceTexture;
sp<IGraphicBufferProducer> mVideoSurfaceTexture;

// only safe to access from within Realize and looper
sp<IMediaPlayer> mPlayer;
Expand Down
2 changes: 1 addition & 1 deletion src/android/android_GenericPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class GenericPlayer : public AHandler
void getDurationMsec(int* msec); //msec != NULL, ANDROID_UNKNOWN_TIME if unknown
virtual void getPositionMsec(int* msec) = 0; //msec != NULL, ANDROID_UNKNOWN_TIME if unknown

virtual void setVideoSurfaceTexture(const sp<ISurfaceTexture> &surfaceTexture) {}
virtual void setVideoSurfaceTexture(const sp<IGraphicBufferProducer> &bufferProducer) {}

void setVolume(float leftVol, float rightVol);
void attachAuxEffect(int32_t effectId);
Expand Down
4 changes: 2 additions & 2 deletions src/android/android_LocAVPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void LocAVPlayer::onPrepare() {
if (mediaPlayerService != NULL) {
switch (mDataLocatorType) {
case kDataLocatorUri:
mPlayer = mediaPlayerService->create(getpid(), mPlayerClient /*IMediaPlayerClient*/,
mPlayer = mediaPlayerService->create(mPlayerClient /*IMediaPlayerClient*/,
mPlaybackParams.sessionId);
if (mPlayer == NULL) {
SL_LOGE("media player service failed to create player by URI");
Expand All @@ -56,7 +56,7 @@ void LocAVPlayer::onPrepare() {
}
break;
case kDataLocatorFd:
mPlayer = mediaPlayerService->create(getpid(), mPlayerClient /*IMediaPlayerClient*/,
mPlayer = mediaPlayerService->create(mPlayerClient /*IMediaPlayerClient*/,
mPlaybackParams.sessionId);
if (mPlayer == NULL) {
SL_LOGE("media player service failed to create player by FD");
Expand Down
2 changes: 1 addition & 1 deletion src/android/android_StreamPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void StreamPlayer::onPrepare() {
SL_LOGD("StreamPlayer::onPrepare()");
sp<IMediaPlayerService> mediaPlayerService(getMediaPlayerService());
if (mediaPlayerService != NULL) {
mPlayer = mediaPlayerService->create(getpid(), mPlayerClient /*IMediaPlayerClient*/,
mPlayer = mediaPlayerService->create(mPlayerClient /*IMediaPlayerClient*/,
mPlaybackParams.sessionId);
if (mPlayer == NULL) {
SL_LOGE("media player service failed to create player by app proxy");
Expand Down
6 changes: 4 additions & 2 deletions src/android/android_sles_conversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,15 @@ static inline audio_format_t sles_to_android_sampleFormat(SLuint32 pcmFormat) {
}


static inline audio_channel_mask_t sles_to_android_channelMaskIn(SLuint32 nbChannels, SLuint32 channelMask) {
static inline audio_channel_mask_t sles_to_android_channelMaskIn(SLuint32 nbChannels,
SLuint32 channelMask) {
// FIXME handle channel mask mapping between SL ES and Android
return audio_channel_in_mask_from_count(nbChannels);
}


static inline audio_channel_mask_t sles_to_android_channelMaskOut(SLuint32 nbChannels, SLuint32 channelMask) {
static inline audio_channel_mask_t sles_to_android_channelMaskOut(SLuint32 nbChannels,
SLuint32 channelMask) {
// FIXME handle channel mask mapping between SL ES and Android
return audio_channel_out_mask_from_count(nbChannels);
}
Expand Down
4 changes: 4 additions & 0 deletions src/assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <utils/Log.h>

#pragma GCC visibility push(default)

void __assert(const char *file, int line, const char *failedexpr)
{
LOG_ALWAYS_FATAL("assertion \"%s\" failed: file \"%s\", line %d", failedexpr, file, line);
Expand All @@ -31,3 +33,5 @@ void __assert2(const char *file, int line, const char *func, const char *failede
failedexpr, file, line, func);
// not reached
}

#pragma GCC visibility pop
6 changes: 4 additions & 2 deletions tests/mimeUri/slesTestSlowDownUri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ void TestSlowDownUri( SLObjectItf sl, const char* path)
res = (*seekItf)->SetLoop(seekItf, SL_BOOLEAN_TRUE, 0, SL_TIME_UNKNOWN); CheckErr(res);

/* Set up marker and position callbacks */
res = (*playItf)->RegisterCallback(playItf, PlayEventCallback, (void *) rateItf); CheckErr(res);
res = (*playItf)->RegisterCallback(playItf, PlayEventCallback, (void *) rateItf);
CheckErr(res);
res = (*playItf)->SetCallbackEventsMask(playItf,
SL_PLAYEVENT_HEADATEND | SL_PLAYEVENT_HEADATMARKER | SL_PLAYEVENT_HEADATNEWPOS);
res = (*playItf)->SetMarkerPosition(playItf, 1500); CheckErr(res);
Expand All @@ -307,7 +308,8 @@ void TestSlowDownUri( SLObjectItf sl, const char* path)
for (index = 0; ; ++index) {
SLpermille minRate, maxRate, stepSize;
SLuint32 capabilities;
res = (*rateItf)->GetRateRange(rateItf, index, &minRate, &maxRate, &stepSize, &capabilities);
res = (*rateItf)->GetRateRange(rateItf, index, &minRate, &maxRate, &stepSize,
&capabilities);
if (res == SL_RESULT_PARAMETER_INVALID) {
if (index == 0) {
fprintf(stderr, "implementation supports no rate ranges\n");
Expand Down
2 changes: 1 addition & 1 deletion tests/native-media/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LOCAL_CFLAGS += -I$(call include-path-for, wilhelm)
LOCAL_CFLAGS += -UNDEBUG

LOCAL_PRELINK_MODULE := false
LOCAL_SHARED_LIBRARIES += libutils libOpenMAXAL libandroid
LOCAL_SHARED_LIBRARIES += libutils liblog libOpenMAXAL libandroid


include $(BUILD_SHARED_LIBRARY)
2 changes: 1 addition & 1 deletion tests/native-media/jni/native-media-jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ jboolean Java_com_example_nativemedia_NativeMedia_createStreamingMediaPlayer(JNI
// configure image video sink
XADataLocator_NativeDisplay loc_nd = {
XA_DATALOCATOR_NATIVEDISPLAY, // locatorType
// the video sink must be an ANativeWindow created from a Surface or SurfaceTexture
// the video sink must be an ANativeWindow created from a Surface or SurfaceTextureClient
(void*)theNativeWindow, // hWindow
// must be NULL
NULL // hDisplay
Expand Down
26 changes: 22 additions & 4 deletions tests/sandbox/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

ifeq ($(TARGET_OS),linux)
Expand Down Expand Up @@ -42,6 +43,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

ifeq ($(TARGET_OS),linux)
Expand Down Expand Up @@ -69,6 +71,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -99,6 +102,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -128,6 +132,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

ifeq ($(TARGET_OS),linux)
Expand All @@ -154,6 +159,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -183,6 +189,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -213,6 +220,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -242,6 +250,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -271,6 +280,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -300,6 +310,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand All @@ -322,13 +333,17 @@ include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests

LOCAL_C_INCLUDES:= \
$(call include-path-for, wilhelm)
$(call include-path-for, wilhelm) \
$(call include-path-for, audio-utils)

LOCAL_SRC_FILES:= \
playbq.c
playbq.cpp

LOCAL_SHARED_LIBRARIES := \
libaudioutils \
libnbaio \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand All @@ -343,8 +358,7 @@ LOCAL_CFLAGS += -UNDEBUG

LOCAL_MODULE:= slesTest_playbq

# commented out because libsndfile is not yet standard
#include $(BUILD_EXECUTABLE)
include $(BUILD_EXECUTABLE)

# monkey

Expand All @@ -360,6 +374,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -389,6 +404,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenMAXAL

LOCAL_STATIC_LIBRARIES := \
Expand Down Expand Up @@ -418,6 +434,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenSLES \
libOpenMAXAL

Expand Down Expand Up @@ -448,6 +465,7 @@ LOCAL_SRC_FILES:= \

LOCAL_SHARED_LIBRARIES := \
libutils \
liblog \
libOpenMAXAL \
libgui \
libbinder \
Expand Down
Loading

0 comments on commit 073b588

Please sign in to comment.