diff options
-rw-r--r-- | cmds/stagefright/stagefright.cpp | 3 | ||||
-rw-r--r-- | cmds/stagefright/stream.cpp | 2 | ||||
-rw-r--r-- | include/media/IAudioFlinger.h | 4 | ||||
-rw-r--r-- | include/media/IMediaPlayerService.h | 6 | ||||
-rw-r--r-- | media/libmedia/AudioEffect.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 3 | ||||
-rw-r--r-- | media/libmedia/IAudioFlinger.cpp | 16 | ||||
-rw-r--r-- | media/libmedia/IMediaPlayerService.cpp | 18 | ||||
-rw-r--r-- | media/libmedia/mediametadataretriever.cpp | 2 | ||||
-rw-r--r-- | media/libmedia/mediaplayer.cpp | 6 | ||||
-rw-r--r-- | media/libmedia/mediarecorder.cpp | 2 | ||||
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerService.cpp | 9 | ||||
-rw-r--r-- | media/libmediaplayerservice/MediaPlayerService.h | 6 | ||||
-rw-r--r-- | media/libstagefright/wifi-display/sink/TunnelRenderer.cpp | 2 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 7 | ||||
-rw-r--r-- | services/audioflinger/AudioFlinger.h | 4 |
17 files changed, 39 insertions, 55 deletions
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index 148b66e..ad68a21 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -22,7 +22,6 @@ #include <stdlib.h> #include <string.h> -#include <unistd.h> #include "jpeg.h" #include "SineSource.h" @@ -821,7 +820,7 @@ int main(int argc, char **argv) { CHECK(service.get() != NULL); sp<IMediaMetadataRetriever> retriever = - service->createMetadataRetriever(getpid()); + service->createMetadataRetriever(); CHECK(retriever != NULL); diff --git a/cmds/stagefright/stream.cpp b/cmds/stagefright/stream.cpp index 7329dcc..af6afe0 100644 --- a/cmds/stagefright/stream.cpp +++ b/cmds/stagefright/stream.cpp @@ -370,7 +370,7 @@ int main(int argc, char **argv) { } sp<IMediaPlayer> player = - service->create(getpid(), client, 0); + service->create(client, 0); if (player != NULL && player->setDataSource(source) == NO_ERROR) { player->setVideoSurfaceTexture(surface->getSurfaceTexture()); diff --git a/include/media/IAudioFlinger.h b/include/media/IAudioFlinger.h index 9727143..9c3067e 100644 --- a/include/media/IAudioFlinger.h +++ b/include/media/IAudioFlinger.h @@ -56,7 +56,6 @@ public: * return null if the track cannot be created. */ virtual sp<IAudioTrack> createTrack( - pid_t pid, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -70,7 +69,6 @@ public: status_t *status) = 0; virtual sp<IAudioRecord> openRecord( - pid_t pid, audio_io_handle_t input, uint32_t sampleRate, audio_format_t format, @@ -174,7 +172,7 @@ public: virtual status_t getEffectDescriptor(const effect_uuid_t *pEffectUUID, effect_descriptor_t *pDescriptor) const = 0; - virtual sp<IEffect> createEffect(pid_t pid, + virtual sp<IEffect> createEffect( effect_descriptor_t *pDesc, const sp<IEffectClient>& client, int32_t priority, diff --git a/include/media/IMediaPlayerService.h b/include/media/IMediaPlayerService.h index 7a89135..44db5bc 100644 --- a/include/media/IMediaPlayerService.h +++ b/include/media/IMediaPlayerService.h @@ -44,9 +44,9 @@ class IMediaPlayerService: public IInterface public: DECLARE_META_INTERFACE(MediaPlayerService); - virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) = 0; - virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) = 0; - virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0; + virtual sp<IMediaRecorder> createMediaRecorder() = 0; + virtual sp<IMediaMetadataRetriever> createMetadataRetriever() = 0; + virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client, int audioSessionId = 0) = 0; virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat) = 0; diff --git a/media/libmedia/AudioEffect.cpp b/media/libmedia/AudioEffect.cpp index 3317d57..8dfffb3 100644 --- a/media/libmedia/AudioEffect.cpp +++ b/media/libmedia/AudioEffect.cpp @@ -127,7 +127,7 @@ status_t AudioEffect::set(const effect_uuid_t *type, mIEffectClient = new EffectClient(this); - iEffect = audioFlinger->createEffect(getpid(), &mDescriptor, + iEffect = audioFlinger->createEffect((effect_descriptor_t *)&mDescriptor, mIEffectClient, priority, io, mSessionId, &mStatus, &mId, &enabled); if (iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) { diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index c2ef68c..3db69a4 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -444,7 +444,7 @@ status_t AudioRecord::openRecord_l( // FIXME see similar logic at AudioTrack int originalSessionId = mSessionId; - sp<IAudioRecord> record = audioFlinger->openRecord(getpid(), input, + sp<IAudioRecord> record = audioFlinger->openRecord(input, sampleRate, format, mChannelMask, frameCount, diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 1d87ff8..d0872f0 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -837,8 +837,7 @@ status_t AudioTrack::createTrack_l( } } - sp<IAudioTrack> track = audioFlinger->createTrack(getpid(), - streamType, + sp<IAudioTrack> track = audioFlinger->createTrack(streamType, sampleRate, // AudioFlinger only sees 16-bit PCM format == AUDIO_FORMAT_PCM_8_BIT ? diff --git a/media/libmedia/IAudioFlinger.cpp b/media/libmedia/IAudioFlinger.cpp index c5fbbf0..2f18680 100644 --- a/media/libmedia/IAudioFlinger.cpp +++ b/media/libmedia/IAudioFlinger.cpp @@ -84,7 +84,6 @@ public: } virtual sp<IAudioTrack> createTrack( - pid_t pid, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -100,7 +99,6 @@ public: Parcel data, reply; sp<IAudioTrack> track; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); - data.writeInt32(pid); data.writeInt32((int32_t) streamType); data.writeInt32(sampleRate); data.writeInt32(format); @@ -138,7 +136,6 @@ public: } virtual sp<IAudioRecord> openRecord( - pid_t pid, audio_io_handle_t input, uint32_t sampleRate, audio_format_t format, @@ -152,7 +149,6 @@ public: Parcel data, reply; sp<IAudioRecord> record; data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); - data.writeInt32(pid); data.writeInt32((int32_t) input); data.writeInt32(sampleRate); data.writeInt32(format); @@ -612,7 +608,7 @@ public: return NO_ERROR; } - virtual sp<IEffect> createEffect(pid_t pid, + virtual sp<IEffect> createEffect( effect_descriptor_t *pDesc, const sp<IEffectClient>& client, int32_t priority, @@ -633,7 +629,6 @@ public: } data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor()); - data.writeInt32(pid); data.write(pDesc, sizeof(effect_descriptor_t)); data.writeStrongBinder(client->asBinder()); data.writeInt32(priority); @@ -712,7 +707,6 @@ status_t BnAudioFlinger::onTransact( switch (code) { case CREATE_TRACK: { CHECK_INTERFACE(IAudioFlinger, data, reply); - pid_t pid = data.readInt32(); int streamType = data.readInt32(); uint32_t sampleRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); @@ -724,7 +718,7 @@ status_t BnAudioFlinger::onTransact( pid_t tid = (pid_t) data.readInt32(); int sessionId = data.readInt32(); status_t status; - sp<IAudioTrack> track = createTrack(pid, + sp<IAudioTrack> track = createTrack( (audio_stream_type_t) streamType, sampleRate, format, channelMask, frameCount, &flags, buffer, output, tid, &sessionId, &status); reply->writeInt32(flags); @@ -735,7 +729,6 @@ status_t BnAudioFlinger::onTransact( } break; case OPEN_RECORD: { CHECK_INTERFACE(IAudioFlinger, data, reply); - pid_t pid = data.readInt32(); audio_io_handle_t input = (audio_io_handle_t) data.readInt32(); uint32_t sampleRate = data.readInt32(); audio_format_t format = (audio_format_t) data.readInt32(); @@ -745,7 +738,7 @@ status_t BnAudioFlinger::onTransact( pid_t tid = (pid_t) data.readInt32(); int sessionId = data.readInt32(); status_t status; - sp<IAudioRecord> record = openRecord(pid, input, + sp<IAudioRecord> record = openRecord(input, sampleRate, format, channelMask, frameCount, flags, tid, &sessionId, &status); reply->writeInt32(sessionId); reply->writeInt32(status); @@ -1021,7 +1014,6 @@ status_t BnAudioFlinger::onTransact( } case CREATE_EFFECT: { CHECK_INTERFACE(IAudioFlinger, data, reply); - pid_t pid = data.readInt32(); effect_descriptor_t desc; data.read(&desc, sizeof(effect_descriptor_t)); sp<IEffectClient> client = interface_cast<IEffectClient>(data.readStrongBinder()); @@ -1032,7 +1024,7 @@ status_t BnAudioFlinger::onTransact( int id; int enabled; - sp<IEffect> effect = createEffect(pid, &desc, client, priority, output, sessionId, + sp<IEffect> effect = createEffect(&desc, client, priority, output, sessionId, &status, &id, &enabled); reply->writeInt32(status); reply->writeInt32(id); diff --git a/media/libmedia/IMediaPlayerService.cpp b/media/libmedia/IMediaPlayerService.cpp index c0a0260..ae76c10 100644 --- a/media/libmedia/IMediaPlayerService.cpp +++ b/media/libmedia/IMediaPlayerService.cpp @@ -56,20 +56,18 @@ public: { } - virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid) + virtual sp<IMediaMetadataRetriever> createMetadataRetriever() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeInt32(pid); remote()->transact(CREATE_METADATA_RETRIEVER, data, &reply); return interface_cast<IMediaMetadataRetriever>(reply.readStrongBinder()); } virtual sp<IMediaPlayer> create( - pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId) { + const sp<IMediaPlayerClient>& client, int audioSessionId) { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeInt32(pid); data.writeStrongBinder(client->asBinder()); data.writeInt32(audioSessionId); @@ -77,11 +75,10 @@ public: return interface_cast<IMediaPlayer>(reply.readStrongBinder()); } - virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid) + virtual sp<IMediaRecorder> createMediaRecorder() { Parcel data, reply; data.writeInterfaceToken(IMediaPlayerService::getInterfaceDescriptor()); - data.writeInt32(pid); remote()->transact(CREATE_MEDIA_RECORDER, data, &reply); return interface_cast<IMediaRecorder>(reply.readStrongBinder()); } @@ -168,11 +165,10 @@ status_t BnMediaPlayerService::onTransact( switch (code) { case CREATE: { CHECK_INTERFACE(IMediaPlayerService, data, reply); - pid_t pid = data.readInt32(); sp<IMediaPlayerClient> client = interface_cast<IMediaPlayerClient>(data.readStrongBinder()); int audioSessionId = data.readInt32(); - sp<IMediaPlayer> player = create(pid, client, audioSessionId); + sp<IMediaPlayer> player = create(client, audioSessionId); reply->writeStrongBinder(player->asBinder()); return NO_ERROR; } break; @@ -206,15 +202,13 @@ status_t BnMediaPlayerService::onTransact( } break; case CREATE_MEDIA_RECORDER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); - pid_t pid = data.readInt32(); - sp<IMediaRecorder> recorder = createMediaRecorder(pid); + sp<IMediaRecorder> recorder = createMediaRecorder(); reply->writeStrongBinder(recorder->asBinder()); return NO_ERROR; } break; case CREATE_METADATA_RETRIEVER: { CHECK_INTERFACE(IMediaPlayerService, data, reply); - pid_t pid = data.readInt32(); - sp<IMediaMetadataRetriever> retriever = createMetadataRetriever(pid); + sp<IMediaMetadataRetriever> retriever = createMetadataRetriever(); reply->writeStrongBinder(retriever->asBinder()); return NO_ERROR; } break; diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp index b0241aa..110b94c 100644 --- a/media/libmedia/mediametadataretriever.cpp +++ b/media/libmedia/mediametadataretriever.cpp @@ -64,7 +64,7 @@ MediaMetadataRetriever::MediaMetadataRetriever() ALOGE("failed to obtain MediaMetadataRetrieverService"); return; } - sp<IMediaMetadataRetriever> retriever(service->createMetadataRetriever(getpid())); + sp<IMediaMetadataRetriever> retriever(service->createMetadataRetriever()); if (retriever == 0) { ALOGE("failed to create IMediaMetadataRetriever object from server"); } diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index bbbf4b6..dbff8dc 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -143,7 +143,7 @@ status_t MediaPlayer::setDataSource( if (url != NULL) { const sp<IMediaPlayerService>& service(getMediaPlayerService()); if (service != 0) { - sp<IMediaPlayer> player(service->create(getpid(), this, mAudioSessionId)); + sp<IMediaPlayer> player(service->create(this, mAudioSessionId)); if ((NO_ERROR != doSetRetransmitEndpoint(player)) || (NO_ERROR != player->setDataSource(url, headers))) { player.clear(); @@ -160,7 +160,7 @@ status_t MediaPlayer::setDataSource(int fd, int64_t offset, int64_t length) status_t err = UNKNOWN_ERROR; const sp<IMediaPlayerService>& service(getMediaPlayerService()); if (service != 0) { - sp<IMediaPlayer> player(service->create(getpid(), this, mAudioSessionId)); + sp<IMediaPlayer> player(service->create(this, mAudioSessionId)); if ((NO_ERROR != doSetRetransmitEndpoint(player)) || (NO_ERROR != player->setDataSource(fd, offset, length))) { player.clear(); @@ -176,7 +176,7 @@ status_t MediaPlayer::setDataSource(const sp<IStreamSource> &source) status_t err = UNKNOWN_ERROR; const sp<IMediaPlayerService>& service(getMediaPlayerService()); if (service != 0) { - sp<IMediaPlayer> player(service->create(getpid(), this, mAudioSessionId)); + sp<IMediaPlayer> player(service->create(this, mAudioSessionId)); if ((NO_ERROR != doSetRetransmitEndpoint(player)) || (NO_ERROR != player->setDataSource(source))) { player.clear(); diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp index 9541015..46a8f54 100644 --- a/media/libmedia/mediarecorder.cpp +++ b/media/libmedia/mediarecorder.cpp @@ -620,7 +620,7 @@ MediaRecorder::MediaRecorder() : mSurfaceMediaSource(NULL) const sp<IMediaPlayerService>& service(getMediaPlayerService()); if (service != NULL) { - mMediaRecorder = service->createMediaRecorder(getpid()); + mMediaRecorder = service->createMediaRecorder(); } if (mMediaRecorder != NULL) { mCurrentState = MEDIA_RECORDER_IDLE; diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index c3e5c40..c211072 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -224,8 +224,9 @@ MediaPlayerService::~MediaPlayerService() ALOGV("MediaPlayerService destroyed"); } -sp<IMediaRecorder> MediaPlayerService::createMediaRecorder(pid_t pid) +sp<IMediaRecorder> MediaPlayerService::createMediaRecorder() { + pid_t pid = IPCThreadState::self()->getCallingPid(); sp<MediaRecorderClient> recorder = new MediaRecorderClient(this, pid); wp<MediaRecorderClient> w = recorder; Mutex::Autolock lock(mLock); @@ -241,16 +242,18 @@ void MediaPlayerService::removeMediaRecorderClient(wp<MediaRecorderClient> clien ALOGV("Delete media recorder client"); } -sp<IMediaMetadataRetriever> MediaPlayerService::createMetadataRetriever(pid_t pid) +sp<IMediaMetadataRetriever> MediaPlayerService::createMetadataRetriever() { + pid_t pid = IPCThreadState::self()->getCallingPid(); sp<MetadataRetrieverClient> retriever = new MetadataRetrieverClient(pid); ALOGV("Create new media retriever from pid %d", pid); return retriever; } -sp<IMediaPlayer> MediaPlayerService::create(pid_t pid, const sp<IMediaPlayerClient>& client, +sp<IMediaPlayer> MediaPlayerService::create(const sp<IMediaPlayerClient>& client, int audioSessionId) { + pid_t pid = IPCThreadState::self()->getCallingPid(); int32_t connId = android_atomic_inc(&mNextConnId); sp<Client> c = new Client( diff --git a/media/libmediaplayerservice/MediaPlayerService.h b/media/libmediaplayerservice/MediaPlayerService.h index fd648df..a8af66e 100644 --- a/media/libmediaplayerservice/MediaPlayerService.h +++ b/media/libmediaplayerservice/MediaPlayerService.h @@ -239,11 +239,11 @@ public: static void instantiate(); // IMediaPlayerService interface - virtual sp<IMediaRecorder> createMediaRecorder(pid_t pid); + virtual sp<IMediaRecorder> createMediaRecorder(); void removeMediaRecorderClient(wp<MediaRecorderClient> client); - virtual sp<IMediaMetadataRetriever> createMetadataRetriever(pid_t pid); + virtual sp<IMediaMetadataRetriever> createMetadataRetriever(); - virtual sp<IMediaPlayer> create(pid_t pid, const sp<IMediaPlayerClient>& client, int audioSessionId); + virtual sp<IMediaPlayer> create(const sp<IMediaPlayerClient>& client, int audioSessionId); virtual sp<IMemory> decode(const char* url, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat); virtual sp<IMemory> decode(int fd, int64_t offset, int64_t length, uint32_t *pSampleRate, int* pNumChannels, audio_format_t* pFormat); diff --git a/media/libstagefright/wifi-display/sink/TunnelRenderer.cpp b/media/libstagefright/wifi-display/sink/TunnelRenderer.cpp index b913124..558fd41 100644 --- a/media/libstagefright/wifi-display/sink/TunnelRenderer.cpp +++ b/media/libstagefright/wifi-display/sink/TunnelRenderer.cpp @@ -370,7 +370,7 @@ void TunnelRenderer::initPlayer() { mPlayerClient = new PlayerClient; - mPlayer = service->create(getpid(), mPlayerClient, 0); + mPlayer = service->create(mPlayerClient, 0); CHECK(mPlayer != NULL); CHECK_EQ(mPlayer->setDataSource(mStreamSource), (status_t)OK); diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index 514fcb1..5f5b041 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -344,7 +344,6 @@ sp<AudioFlinger::Client> AudioFlinger::registerPid_l(pid_t pid) sp<IAudioTrack> AudioFlinger::createTrack( - pid_t pid, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -389,6 +388,7 @@ sp<IAudioTrack> AudioFlinger::createTrack( goto Exit; } + pid_t pid = IPCThreadState::self()->getCallingPid(); client = registerPid_l(pid); ALOGV("createTrack() sessionId: %d", (sessionId == NULL) ? -2 : *sessionId); @@ -1120,7 +1120,6 @@ void AudioFlinger::NotificationClient::binderDied(const wp<IBinder>& who) // ---------------------------------------------------------------------------- sp<IAudioRecord> AudioFlinger::openRecord( - pid_t pid, audio_io_handle_t input, uint32_t sampleRate, audio_format_t format, @@ -1154,6 +1153,7 @@ sp<IAudioRecord> AudioFlinger::openRecord( goto Exit; } + pid_t pid = IPCThreadState::self()->getCallingPid(); client = registerPid_l(pid); // If no audio session id is provided, create one here @@ -1877,7 +1877,7 @@ status_t AudioFlinger::getEffectDescriptor(const effect_uuid_t *pUuid, } -sp<IEffect> AudioFlinger::createEffect(pid_t pid, +sp<IEffect> AudioFlinger::createEffect( effect_descriptor_t *pDesc, const sp<IEffectClient>& effectClient, int32_t priority, @@ -1891,6 +1891,7 @@ sp<IEffect> AudioFlinger::createEffect(pid_t pid, sp<EffectHandle> handle; effect_descriptor_t desc; + pid_t pid = IPCThreadState::self()->getCallingPid(); ALOGV("createEffect pid %d, effectClient %p, priority %d, sessionId %d, io %d", pid, effectClient.get(), priority, sessionId, io); diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h index 6d3f0a1..a28f47e 100644 --- a/services/audioflinger/AudioFlinger.h +++ b/services/audioflinger/AudioFlinger.h @@ -92,7 +92,6 @@ public: // IAudioFlinger interface, in binder opcode order virtual sp<IAudioTrack> createTrack( - pid_t pid, audio_stream_type_t streamType, uint32_t sampleRate, audio_format_t format, @@ -106,7 +105,6 @@ public: status_t *status); virtual sp<IAudioRecord> openRecord( - pid_t pid, audio_io_handle_t input, uint32_t sampleRate, audio_format_t format, @@ -197,7 +195,7 @@ public: virtual status_t getEffectDescriptor(const effect_uuid_t *pUuid, effect_descriptor_t *descriptor) const; - virtual sp<IEffect> createEffect(pid_t pid, + virtual sp<IEffect> createEffect( effect_descriptor_t *pDesc, const sp<IEffectClient>& effectClient, int32_t priority, |