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

Commit b15486f9 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "set secure flag for secure file playback" into lmp-dev

parents ac29afac 7e892180
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
 * limitations under the License.
 */

//#define LOG_NDEBUG 0
#define LOG_TAG "GenericSource"

#include "GenericSource.h"

#include "AnotherPacketSource.h"
@@ -65,7 +68,9 @@ NuPlayer::GenericSource::GenericSource(
      mFetchTimedTextDataGeneration(0),
      mDurationUs(0ll),
      mAudioIsVorbis(false),
      mIsWidevine(false) {
      mIsWidevine(false),
      mUIDValid(false),
      mUID(0) {
    DataSource::RegisterDefaultSniffers();

    sp<DataSource> dataSource = new FileSource(dup(fd), offset, length);
@@ -134,6 +139,12 @@ void NuPlayer::GenericSource::initFromDataSource(
            if (mVideoTrack.mSource == NULL) {
                mVideoTrack.mIndex = i;
                mVideoTrack.mSource = track;

                // check if the source requires secure buffers
                int32_t secure;
                if (meta->findInt32(kKeyRequiresSecureBuffers, &secure) && secure) {
                    mIsWidevine = true;
                }
            }
        }

+3 −1
Original line number Diff line number Diff line
@@ -227,7 +227,9 @@ void NuPlayer::setDataSourceAsync(
    } else if ((!strncasecmp(url, "widevine://", 11))) {
        source = new GenericSource(notify, httpService, url, headers,
                true /* isWidevine */, mUIDValid, mUID);
        mSourceFlags |= Source::FLAG_SECURE;
        // Don't set FLAG_SECURE on mSourceFlags here, the correct flags
        // will be updated in Source::kWhatFlagsChanged handler when
        // GenericSource is prepared.
    } else {
        source = new GenericSource(notify, httpService, url, headers);
    }