Widevine extractor changes to support secure media buffer playback.

Supports either secure or insecure buffer configurations, depending
on the build-time flag REQUIRE_SECURE_BUFFERS.

Change-Id: I5b8150315eced4ed9be656b73d91485a6216819d
This commit is contained in:
Jeff Tinker
2011-06-30 15:47:43 -07:00
parent fee0126ed8
commit ba335957e9
4 changed files with 33 additions and 51 deletions

View File

@@ -80,6 +80,21 @@ void WVMMediaSource::allocBufferGroup()
}
status_t WVMMediaSource::setBuffers(const Vector<MediaBuffer *> &buffers) {
#ifdef REQUIRE_SECURE_BUFFERS
LOGI("Using codec-supplied buffers");
delete mGroup;
mGroup = new MediaBufferGroup;
for (size_t i = 0; i < buffers.size(); ++i) {
mGroup->add_buffer(buffers.itemAt(i));
}
return OK;
#else
return ERROR_UNSUPPORTED;
#endif
}
status_t WVMMediaSource::start(MetaData *)
{
@@ -88,7 +103,6 @@ status_t WVMMediaSource::start(MetaData *)
CHECK(!mStarted);
allocBufferGroup();
mNewSegment = true;
mStarted = true;
@@ -102,7 +116,15 @@ status_t WVMMediaSource::start(MetaData *)
LOGE("WV_Play returned status %d in WVMMediaSource::start\n", result);
return ERROR_IO;
}
#ifndef REQUIRE_SECURE_BUFFERS
allocBufferGroup();
#endif
} else {
// audio
allocBufferGroup();
}
return OK;
}
@@ -136,6 +158,13 @@ status_t WVMMediaSource::stop()
sp<MetaData> WVMMediaSource::getFormat()
{
Mutex::Autolock autoLock(mLock);
#ifdef REQUIRE_SECURE_BUFFERS
if (mESSelector == WV_EsSelector_Video) {
mTrackMetaData->setInt32(kKeyRequiresSecureBuffers, true);
}
#endif
return mTrackMetaData;
}