Added getter for session Id to AudioSink

Added a method to expose the audio session id at AudioSink interface
so that the AudioPlayer in stagefright can retrieve it.

Also:
- Fixed audio effect send level not being initialized in mediaplayer.
- Fixed compilation error when LOGV is enabled in mediaplayer JNI

Change-Id: I4bb55454fd63d646e0e677692d737c4843fb05fb
This commit is contained in:
Eric Laurent
2010-10-07 18:23:03 -07:00
parent 36a1828705
commit b3bdf3f008
5 changed files with 15 additions and 1 deletions

View File

@@ -76,6 +76,7 @@ public:
virtual uint32_t latency() const = 0;
virtual float msecsPerFrame() const = 0;
virtual status_t getPosition(uint32_t *position) = 0;
virtual int getSessionId() = 0;
// If no callback is specified, use the "write" API below to submit
// audio data.

View File

@@ -727,7 +727,7 @@ android_media_MediaPlayer_setAuxEffectSendLevel(JNIEnv *env, jobject thiz, jfloa
}
static void android_media_MediaPlayer_attachAuxEffect(JNIEnv *env, jobject thiz, jint effectId) {
LOGV("attachAuxEffect(): %d", sessionId);
LOGV("attachAuxEffect(): %d", effectId);
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);

View File

@@ -56,6 +56,7 @@ MediaPlayer::MediaPlayer()
mVideoWidth = mVideoHeight = 0;
mLockThreadId = 0;
mAudioSessionId = AudioSystem::newAudioSessionId();
mSendLevel = 0;
}
MediaPlayer::~MediaPlayer()

View File

@@ -1546,6 +1546,11 @@ void MediaPlayerService::AudioOutput::CallbackWrapper(
}
int MediaPlayerService::AudioOutput::getSessionId()
{
return mSessionId;
}
#undef LOG_TAG
#define LOG_TAG "AudioCache"
MediaPlayerService::AudioCache::AudioCache(const char* name) :
@@ -1733,4 +1738,9 @@ void MediaPlayerService::AudioCache::notify(void* cookie, int msg, int ext1, int
p->mSignal.signal();
}
int MediaPlayerService::AudioCache::getSessionId()
{
return 0;
}
} // namespace android

View File

@@ -77,6 +77,7 @@ class MediaPlayerService : public BnMediaPlayerService
virtual uint32_t latency() const;
virtual float msecsPerFrame() const;
virtual status_t getPosition(uint32_t *position);
virtual int getSessionId();
virtual status_t open(
uint32_t sampleRate, int channelCount,
@@ -133,6 +134,7 @@ class MediaPlayerService : public BnMediaPlayerService
virtual uint32_t latency() const;
virtual float msecsPerFrame() const;
virtual status_t getPosition(uint32_t *position);
virtual int getSessionId();
virtual status_t open(
uint32_t sampleRate, int channelCount, int format,