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

Commit 7e892180 authored by Chong Zhang's avatar Chong Zhang
Browse files

set secure flag for secure file playback

Bug: 16786456
Change-Id: I06f18b0e9c3f65e3e127369baa1f9ea8c9307762
parent c2320223
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);
    }