summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-02-03 11:06:53 -0800
committerGlenn Kasten <gkasten@google.com>2012-12-18 16:16:30 -0800
commitf37971f624164c3ed185d3f976404a6f60f49b9a (patch)
treee3455056e9e0512786cfdd832e1fd8bba765bc7c /media
parent34d7db5dd43000cac7e8e156d79e9f97ccbb8990 (diff)
downloadframeworks_av-f37971f624164c3ed185d3f976404a6f60f49b9a.zip
frameworks_av-f37971f624164c3ed185d3f976404a6f60f49b9a.tar.gz
frameworks_av-f37971f624164c3ed185d3f976404a6f60f49b9a.tar.bz2
Remove unnecessary parameter
Just get the parameter on server side Change-Id: I433a63104dbb257e0d862be2ab61847cb36d1c15
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioEffect.cpp2
-rw-r--r--media/libmedia/AudioRecord.cpp2
-rw-r--r--media/libmedia/AudioTrack.cpp3
-rw-r--r--media/libmedia/IAudioFlinger.cpp16
-rw-r--r--media/libmedia/IMediaPlayerService.cpp18
-rw-r--r--media/libmedia/mediametadataretriever.cpp2
-rw-r--r--media/libmedia/mediaplayer.cpp6
-rw-r--r--media/libmedia/mediarecorder.cpp2
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.cpp9
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.h6
-rw-r--r--media/libstagefright/wifi-display/sink/TunnelRenderer.cpp2
11 files changed, 28 insertions, 40 deletions
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);