Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fc17d1a authored by Lajos Molnar's avatar Lajos Molnar
Browse files

stagefright: change signature of MediaCodec::Create methods

Most clients already have AString when creating codecs, and
internally we use AString.

const char * automatically casts to AString, but it does incur a
copy cost, so we incur it on every MediaCodec::Create call.

Bug: 17108024
Change-Id: I213dde7a6fc3cf3756eee6afd7194413bcca54a5
parent b60521e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -64,11 +64,11 @@ struct MediaCodec : public AHandler {
    static const pid_t kNoPid = -1;

    static sp<MediaCodec> CreateByType(
            const sp<ALooper> &looper, const char *mime, bool encoder, status_t *err = NULL,
            const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err = NULL,
            pid_t pid = kNoPid);

    static sp<MediaCodec> CreateByComponentName(
            const sp<ALooper> &looper, const char *name, status_t *err = NULL,
            const sp<ALooper> &looper, const AString &name, status_t *err = NULL,
            pid_t pid = kNoPid);

    static sp<PersistentSurface> CreatePersistentInputSurface();
+2 −2
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ bool MediaCodec::ResourceManagerServiceProxy::reclaimResource(

// static
sp<MediaCodec> MediaCodec::CreateByType(
        const sp<ALooper> &looper, const char *mime, bool encoder, status_t *err, pid_t pid) {
        const sp<ALooper> &looper, const AString &mime, bool encoder, status_t *err, pid_t pid) {
    sp<MediaCodec> codec = new MediaCodec(looper, pid);

    const status_t ret = codec->init(mime, true /* nameIsType */, encoder);
@@ -183,7 +183,7 @@ sp<MediaCodec> MediaCodec::CreateByType(

// static
sp<MediaCodec> MediaCodec::CreateByComponentName(
        const sp<ALooper> &looper, const char *name, status_t *err, pid_t pid) {
        const sp<ALooper> &looper, const AString &name, status_t *err, pid_t pid) {
    sp<MediaCodec> codec = new MediaCodec(looper, pid);

    const status_t ret = codec->init(name, false /* nameIsType */, false /* encoder */);