Loading media/libmedia/mediaplayer.cpp +14 −9 Original line number Diff line number Diff line Loading @@ -260,9 +260,10 @@ status_t MediaPlayer::setVideoSurfaceTexture( status_t MediaPlayer::prepareAsync_l() { if ( (mPlayer != 0) && ( mCurrentState & (MEDIA_PLAYER_INITIALIZED | MEDIA_PLAYER_STOPPED) ) ) { mPlayer->setAudioStreamType(mStreamType); if (mAudioAttributesParcel != NULL) { mPlayer->setParameter(KEY_PARAMETER_AUDIO_ATTRIBUTES, *mAudioAttributesParcel); } else { mPlayer->setAudioStreamType(mStreamType); } mCurrentState = MEDIA_PLAYER_PREPARING; return mPlayer->prepareAsync(); Loading Loading @@ -734,24 +735,28 @@ status_t MediaPlayer::checkStateForKeySet_l(int key) status_t MediaPlayer::setParameter(int key, const Parcel& request) { ALOGV("MediaPlayer::setParameter(%d)", key); status_t status = INVALID_OPERATION; Mutex::Autolock _l(mLock); if (checkStateForKeySet_l(key) != OK) { return INVALID_OPERATION; } if (mPlayer != NULL) { return mPlayer->setParameter(key, request); return status; } switch (key) { case KEY_PARAMETER_AUDIO_ATTRIBUTES: // no player, save the marshalled audio attributes // save the marshalled audio attributes if (mAudioAttributesParcel != NULL) { delete mAudioAttributesParcel; }; mAudioAttributesParcel = new Parcel(); mAudioAttributesParcel->appendFrom(&request, 0, request.dataSize()); return OK; status = OK; break; default: ALOGV("setParameter: no active player"); return INVALID_OPERATION; ALOGV_IF(mPlayer == NULL, "setParameter: no active player"); break; } if (mPlayer != NULL) { status = mPlayer->setParameter(key, request); } return status; } status_t MediaPlayer::getParameter(int key, Parcel *reply) Loading media/libmediaplayerservice/MediaPlayerService.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include <utils/Timers.h> #include <utils/Vector.h> #include <media/AudioPolicyHelper.h> #include <media/IMediaHTTPService.h> #include <media/IRemoteDisplay.h> #include <media/IRemoteDisplayClient.h> Loading Loading @@ -1350,6 +1351,10 @@ MediaPlayerService::AudioOutput::AudioOutput(int sessionId, int uid, int pid, mFlags(AUDIO_OUTPUT_FLAG_NONE) { ALOGV("AudioOutput(%d)", sessionId); if (attr != NULL) { mStreamType = audio_attributes_to_stream_type(attr); } setMinBufferCount(); } Loading Loading @@ -1463,6 +1468,17 @@ String8 MediaPlayerService::AudioOutput::getParameters(const String8& keys) void MediaPlayerService::AudioOutput::setAudioAttributes(const audio_attributes_t * attributes) { Mutex::Autolock lock(mLock); mAttributes = attributes; if (attributes != NULL) { mStreamType = audio_attributes_to_stream_type(attributes); } } void MediaPlayerService::AudioOutput::setAudioStreamType(audio_stream_type_t streamType) { // do not allow direct stream type modification if attributes have been set if (mAttributes == NULL) { mStreamType = streamType; } } void MediaPlayerService::AudioOutput::deleteRecycledTrack_l() Loading media/libmediaplayerservice/MediaPlayerService.h +1 −2 Original line number Diff line number Diff line Loading @@ -107,8 +107,7 @@ class MediaPlayerService : public BnMediaPlayerService virtual void flush(); virtual void pause(); virtual void close(); void setAudioStreamType(audio_stream_type_t streamType) { mStreamType = streamType; } void setAudioStreamType(audio_stream_type_t streamType); virtual audio_stream_type_t getAudioStreamType() const { return mStreamType; } void setAudioAttributes(const audio_attributes_t * attributes); Loading Loading
media/libmedia/mediaplayer.cpp +14 −9 Original line number Diff line number Diff line Loading @@ -260,9 +260,10 @@ status_t MediaPlayer::setVideoSurfaceTexture( status_t MediaPlayer::prepareAsync_l() { if ( (mPlayer != 0) && ( mCurrentState & (MEDIA_PLAYER_INITIALIZED | MEDIA_PLAYER_STOPPED) ) ) { mPlayer->setAudioStreamType(mStreamType); if (mAudioAttributesParcel != NULL) { mPlayer->setParameter(KEY_PARAMETER_AUDIO_ATTRIBUTES, *mAudioAttributesParcel); } else { mPlayer->setAudioStreamType(mStreamType); } mCurrentState = MEDIA_PLAYER_PREPARING; return mPlayer->prepareAsync(); Loading Loading @@ -734,24 +735,28 @@ status_t MediaPlayer::checkStateForKeySet_l(int key) status_t MediaPlayer::setParameter(int key, const Parcel& request) { ALOGV("MediaPlayer::setParameter(%d)", key); status_t status = INVALID_OPERATION; Mutex::Autolock _l(mLock); if (checkStateForKeySet_l(key) != OK) { return INVALID_OPERATION; } if (mPlayer != NULL) { return mPlayer->setParameter(key, request); return status; } switch (key) { case KEY_PARAMETER_AUDIO_ATTRIBUTES: // no player, save the marshalled audio attributes // save the marshalled audio attributes if (mAudioAttributesParcel != NULL) { delete mAudioAttributesParcel; }; mAudioAttributesParcel = new Parcel(); mAudioAttributesParcel->appendFrom(&request, 0, request.dataSize()); return OK; status = OK; break; default: ALOGV("setParameter: no active player"); return INVALID_OPERATION; ALOGV_IF(mPlayer == NULL, "setParameter: no active player"); break; } if (mPlayer != NULL) { status = mPlayer->setParameter(key, request); } return status; } status_t MediaPlayer::getParameter(int key, Parcel *reply) Loading
media/libmediaplayerservice/MediaPlayerService.cpp +16 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ #include <utils/Timers.h> #include <utils/Vector.h> #include <media/AudioPolicyHelper.h> #include <media/IMediaHTTPService.h> #include <media/IRemoteDisplay.h> #include <media/IRemoteDisplayClient.h> Loading Loading @@ -1350,6 +1351,10 @@ MediaPlayerService::AudioOutput::AudioOutput(int sessionId, int uid, int pid, mFlags(AUDIO_OUTPUT_FLAG_NONE) { ALOGV("AudioOutput(%d)", sessionId); if (attr != NULL) { mStreamType = audio_attributes_to_stream_type(attr); } setMinBufferCount(); } Loading Loading @@ -1463,6 +1468,17 @@ String8 MediaPlayerService::AudioOutput::getParameters(const String8& keys) void MediaPlayerService::AudioOutput::setAudioAttributes(const audio_attributes_t * attributes) { Mutex::Autolock lock(mLock); mAttributes = attributes; if (attributes != NULL) { mStreamType = audio_attributes_to_stream_type(attributes); } } void MediaPlayerService::AudioOutput::setAudioStreamType(audio_stream_type_t streamType) { // do not allow direct stream type modification if attributes have been set if (mAttributes == NULL) { mStreamType = streamType; } } void MediaPlayerService::AudioOutput::deleteRecycledTrack_l() Loading
media/libmediaplayerservice/MediaPlayerService.h +1 −2 Original line number Diff line number Diff line Loading @@ -107,8 +107,7 @@ class MediaPlayerService : public BnMediaPlayerService virtual void flush(); virtual void pause(); virtual void close(); void setAudioStreamType(audio_stream_type_t streamType) { mStreamType = streamType; } void setAudioStreamType(audio_stream_type_t streamType); virtual audio_stream_type_t getAudioStreamType() const { return mStreamType; } void setAudioAttributes(const audio_attributes_t * attributes); Loading