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

Commit 797a0e9e authored by Dongwon Kang's avatar Dongwon Kang Committed by Android (Google) Code Review
Browse files

Merge changes from topic "mp2_ndk"

* changes:
  MediaPlayer2: replace IPCThreadState with libbinder_ndk.
  Completely remove Metadata from MediaPlayer2.
parents 4400c979 919f85f2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ cc_library_static {
        "libandroid_runtime",
        "libaudioclient",
        "libbinder",
        "libbinder_ndk",
        "libcutils",
        "libgui",
        "liblog",
+0 −13
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <media/AudioSystem.h>
#include <media/AudioTimestamp.h>
#include <media/BufferingSettings.h>
#include <media/Metadata.h>
#include <media/stagefright/foundation/AHandler.h>
#include <mediaplayer2/MediaPlayer2Types.h>

@@ -224,18 +223,6 @@ public:
    // @return OK if the call was successful.
    virtual status_t invoke(const PlayerMessage &request, PlayerMessage *reply) = 0;

    // The Client in the MetadataPlayerService calls this method on
    // the native player to retrieve all or a subset of metadata.
    //
    // @param ids SortedList of metadata ID to be fetch. If empty, all
    //            the known metadata should be returned.
    // @param[inout] records Parcel where the player appends its metadata.
    // @return OK if the call was successful.
    virtual status_t getMetadata(const media::Metadata::Filter& /* ids */,
                                 Parcel* /* records */) {
        return INVALID_OPERATION;
    };

    void setListener(const sp<MediaPlayer2InterfaceListener> &listener) {
        Mutex::Autolock autoLock(mListenerLock);
        mListener = listener;
+0 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
#include <media/AVSyncSettings.h>
#include <media/AudioResamplerPublic.h>
#include <media/BufferingSettings.h>
#include <media/Metadata.h>
#include <media/mediaplayer_common.h>
#include <mediaplayer2/MediaPlayer2Interface.h>
#include <mediaplayer2/MediaPlayer2Types.h>
+92 −100
Original line number Diff line number Diff line
@@ -18,14 +18,11 @@
//#define LOG_NDEBUG 0
#define LOG_TAG "MediaPlayer2Native"

#include <binder/IServiceManager.h>
#include <binder/IPCThreadState.h>

#include <android/binder_ibinder.h>
#include <media/AudioSystem.h>
#include <media/DataSourceDesc.h>
#include <media/MediaAnalyticsItem.h>
#include <media/MemoryLeakTrackUtil.h>
#include <media/Metadata.h>
#include <media/NdkWrapper.h>
#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/ALooperRoster.h>
@@ -103,10 +100,6 @@ status_t dumpPlayers(int fd, const Vector<String16>& args) {
    String8 result;
    SortedVector< sp<MediaPlayer2> > players; //to serialise the mutex unlock & client destruction.

    if (checkCallingPermission(String16("android.permission.DUMP")) == false) {
        snprintf(buffer, SIZE, "Permission Denial: can't dump MediaPlayer2\n");
        result.append(buffer);
    } else {
    {
        Mutex::Autolock lock(sRecordLock);
        ensureInit_l();
@@ -210,7 +203,7 @@ status_t dumpPlayers(int fd, const Vector<String16>& args) {
        //std::string s = GetUnreachableMemoryString(true /* contents */, 10000 /* limit */);
        //result.append(s.c_str(), s.size());
    }
    }

    write(fd, result.string(), result.size());
    return NO_ERROR;
}
@@ -253,9 +246,8 @@ MediaPlayer2::MediaPlayer2(int32_t sessionId) {
    mVideoWidth = mVideoHeight = 0;
    mSendLevel = 0;

    // TODO: get pid and uid from JAVA
    mPid = IPCThreadState::self()->getCallingPid();
    mUid = IPCThreadState::self()->getCallingUid();
    mPid = AIBinder_getCallingPid();
    mUid = AIBinder_getCallingUid();

    mAudioOutput = new MediaPlayer2AudioOutput(sessionId, mUid, mPid, NULL /*attributes*/);
}
+0 −27
Original line number Diff line number Diff line
@@ -662,33 +662,6 @@ status_t NuPlayer2Driver::getParameter(int key, Parcel *reply) {
    return INVALID_OPERATION;
}

status_t NuPlayer2Driver::getMetadata(
        const media::Metadata::Filter& /* ids */, Parcel *records) {
    Mutex::Autolock autoLock(mLock);

    using media::Metadata;

    Metadata meta(records);

    meta.appendBool(
            Metadata::kPauseAvailable,
            mPlayerFlags & NuPlayer2::Source::FLAG_CAN_PAUSE);

    meta.appendBool(
            Metadata::kSeekBackwardAvailable,
            mPlayerFlags & NuPlayer2::Source::FLAG_CAN_SEEK_BACKWARD);

    meta.appendBool(
            Metadata::kSeekForwardAvailable,
            mPlayerFlags & NuPlayer2::Source::FLAG_CAN_SEEK_FORWARD);

    meta.appendBool(
            Metadata::kSeekAvailable,
            mPlayerFlags & NuPlayer2::Source::FLAG_CAN_SEEK);

    return OK;
}

void NuPlayer2Driver::notifyResetComplete(int64_t /* srcId */) {
    ALOGD("notifyResetComplete(%p)", this);
    Mutex::Autolock autoLock(mLock);
Loading