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

Commit 838be390 authored by Hassan Shojania's avatar Hassan Shojania
Browse files

Modular DRM for MediaPlayer: L3 playback fails at OMX mmap; preparDrm preparing

Bug: 34559906
Bug: 38390836
Bug: 38039230
Bug: 62194380

Test: GTS Tests
Change-Id: I51e2479f745a4c3e271628abdd79efcb97368ec2
parent 0375da69
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1023,9 +1023,12 @@ status_t MediaPlayer::prepareDrm(const uint8_t uuid[16], const Vector<uint8_t>&
        return NO_INIT;
    }

    // Only allowing it in player's prepared state
    if (!(mCurrentState & MEDIA_PLAYER_PREPARED)) {
        ALOGE("prepareDrm must only be called in the prepared state.");
    // Only allowed it in player's preparing/prepared state.
    // We get here only if MEDIA_DRM_INFO has already arrived (e.g., prepare is half-way through or
    // completed) so the state change to "prepared" might not have happened yet (e.g., buffering).
    // Still, we can allow prepareDrm for the use case of being called in OnDrmInfoListener.
    if (!(mCurrentState & (MEDIA_PLAYER_PREPARING | MEDIA_PLAYER_PREPARED))) {
        ALOGE("prepareDrm is called in the wrong state (%d).", mCurrentState);
        return INVALID_OPERATION;
    }

+2 −1
Original line number Diff line number Diff line
@@ -1979,7 +1979,8 @@ status_t NuPlayer::GenericSource::onPrepareDrm(const sp<AMessage> &msg)
    // The legacy mDecryptHandle!=NULL check (for FLAG_PROTECTED) is equivalent to mIsDrmProtected.
    notifyFlagsChanged(
            (mIsSecure ? FLAG_SECURE : 0) |
            (mIsDrmProtected ? FLAG_PROTECTED : 0) |
            // Setting "protected screen" only for L1: b/38390836
            (mIsSecure ? FLAG_PROTECTED : 0) |
            FLAG_CAN_PAUSE |
            FLAG_CAN_SEEK_BACKWARD |
            FLAG_CAN_SEEK_FORWARD |
+3 −0
Original line number Diff line number Diff line
@@ -222,6 +222,7 @@ private:
    int32_t mFetchTimedTextDataGeneration;
    int64_t mDurationUs;
    bool mAudioIsVorbis;
    // Secure codec is required.
    bool mIsSecure;
    bool mIsStreaming;
    bool mUIDValid;
@@ -310,7 +311,9 @@ private:
            bool seeking, bool formatChange, media_track_type trackType, Track *track);

    // Modular DRM
    // The source is DRM protected and is prepared for DRM.
    bool mIsDrmProtected;
    // releaseDrm has been processed.
    bool mIsDrmReleased;
    Vector<String8> mMimes;

+2 −2
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ struct NuPlayer::Source : public AHandler {
        FLAG_CAN_SEEK_FORWARD   = 4,  // the "10 sec forward button"
        FLAG_CAN_SEEK           = 8,  // the "seek bar"
        FLAG_DYNAMIC_DURATION   = 16,
        FLAG_SECURE             = 32,
        FLAG_PROTECTED          = 64,
        FLAG_SECURE             = 32, // Secure codec is required.
        FLAG_PROTECTED          = 64, // The screen needs to be protected (screenshot is disabled).
    };

    enum {