Fix erroneous "format unsupported " error in Play Movies

Only the first 64K of the movie is pulled when sniffing,
if the widevine version metadata is not present in the
sniff buffer then a "format unsupported" error would occur.

This change increases the sniff buffer size to 128K.

bug: 9351294
Change-Id: If162cbea6915bf2b70122afd30e556e9206e8e43
This commit is contained in:
Jeff Tinker
2013-06-13 13:25:54 -07:00
parent f2afd99431
commit 47ef6eba62

View File

@@ -72,22 +72,26 @@ WVMLoadableExtractor *GetInstance(sp<DataSource> 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)) {
ALOGV("IsWidevineMedia - insufficient data: %d", (int)bytesRead);
return false;
}
ssize_t kSniffSize = 128 * 1024;
char *buffer = new char[kSniffSize];
bool result = false;
setenv("WV_SILENT", "true", 1);
bool result = WV_IsWidevineMedia(buffer, sizeof(buffer));
if (buffer) {
ssize_t bytesRead = dataSource->readAt(0, buffer, kSniffSize);
if (bytesRead < kSniffSize) {
ALOGV("IsWidevineMedia - insufficient data: %d", (int)bytesRead);
} else {
setenv("WV_SILENT", "true", 1);
result = WV_IsWidevineMedia(buffer, kSniffSize);
}
delete[] buffer;
}
return result;
}