Implement WV side of the separation of sniffing and decrypt session initialization.
Further optimization may be done to further speed up a drm content playback session related-to-bug: 5725548 Change-Id: Ife69deaf5d2d70bba812fe1a48d9268d8e9530f7
This commit is contained in:
@@ -80,6 +80,27 @@ WVMLoadableExtractor *GetInstance(sp<DataSource> dataSource) {
|
||||
return new WVMExtractorImpl(dataSource);
|
||||
}
|
||||
|
||||
bool IsWidevineMedia(const sp<DataSource>& dataSource) {
|
||||
char buffer[64 * 1024];
|
||||
|
||||
String8 uri = dataSource->getUri();
|
||||
if (uri.getPathExtension() == ".m3u8" || uri.find(".m3u8?") != -1) {
|
||||
// can't sniff live streams - check for .m3u8 file extension
|
||||
return true;
|
||||
}
|
||||
|
||||
ssize_t bytesRead = dataSource->readAt(0, buffer, sizeof(buffer));
|
||||
if (bytesRead < (ssize_t)sizeof(buffer)) {
|
||||
ALOGW("IsWidevineMedia - insufficient data: %d", (int)bytesRead);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = WV_IsWidevineMedia(buffer, sizeof(buffer));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
|
||||
: mFileMetaData(new MetaData()),
|
||||
mDataSource(dataSource),
|
||||
|
||||
Reference in New Issue
Block a user