Update path to Widevine MediaDrm engine credentials
Use separate directories for unit test-generated credentials vs actual credentials, so the unit test credentials don't interfere with the real ones. related-to-bug: 8620943 Merge of: Update path to where CDM persistently stores data https://widevine-internal-review.googlesource.com/#/c/5300/ Rename Keybox File https://widevine-internal-review.googlesource.com/#/c/5240/ ... from the widevine CDM repo. Change-Id: Idefa484b3a2f71f723238f033460bf431ce4209b
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "device_files.pb.h"
|
||||
#include "file_store.h"
|
||||
@@ -14,9 +15,8 @@
|
||||
namespace wvcdm {
|
||||
|
||||
// TODO(rfrias): Make this work for non-unix paths
|
||||
const char* DeviceFiles::kBasePath = "/data/mediadrm";
|
||||
const char* DeviceFiles::kIdmPath = "/data/mediadrm/IDM";
|
||||
const char* DeviceFiles::kCencPath = "/data/mediadrm/IDM/CENC";
|
||||
const char* DeviceFiles::kBasePath = "/data/mediadrm/IDM";
|
||||
const char* DeviceFiles::kPathDelimiter = "/";
|
||||
const char* DeviceFiles::kDeviceCertificateFileName = "cert.bin";
|
||||
|
||||
// Protobuf generated classes.
|
||||
@@ -123,12 +123,14 @@ bool DeviceFiles::StoreFile(const char* name, const std::string& data) {
|
||||
if (!name)
|
||||
return false;
|
||||
|
||||
if (!File::IsDirectory(kCencPath)) {
|
||||
if (!File::CreateDirectory(kCencPath))
|
||||
std::string path = GetBasePath(kBasePath);
|
||||
|
||||
if (!File::IsDirectory(path)) {
|
||||
if (!File::CreateDirectory(path))
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string path = GetPath(kCencPath, name);
|
||||
path += name;
|
||||
|
||||
File file(path, File::kCreate | File::kTruncate | File::kBinary);
|
||||
if (file.IsBad()) {
|
||||
@@ -152,7 +154,7 @@ bool DeviceFiles::RetrieveFile(const char* name, std::string* data) {
|
||||
if (!data)
|
||||
return false;
|
||||
|
||||
std::string path = GetPath(kCencPath, name);
|
||||
std::string path = GetBasePath(kBasePath) + name;
|
||||
|
||||
if (!File::Exists(path)) {
|
||||
LOGW("DeviceFiles::RetrieveFile: %s does not exist", path.c_str());
|
||||
@@ -185,12 +187,11 @@ bool DeviceFiles::RetrieveFile(const char* name, std::string* data) {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string DeviceFiles::GetPath(const char* dir, const char * filename) {
|
||||
std::string DeviceFiles::GetBasePath(const char* dir) {
|
||||
// TODO(rfrias): Make this work for non-unix paths
|
||||
std::string path = dir;
|
||||
path += "/";
|
||||
path += filename;
|
||||
return path;
|
||||
std::stringstream ss;
|
||||
ss << dir << getuid() << kPathDelimiter;
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user