Regular update
Widevine CAS plugin updates include: - Make Android session id little endian - Rename ca_descriptor.proto to media_cas.proto
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include "ca_descriptor.pb.h"
|
||||
#include "cas_events.h"
|
||||
#include "cas_util.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "log.h"
|
||||
#include "media_cas.pb.h"
|
||||
#include "string_conversions.h"
|
||||
#include "widevine_cas_session_map.h"
|
||||
|
||||
|
||||
@@ -36,16 +36,20 @@ static const char kLicenseFileExtension[] = ".lic";
|
||||
// int32_t and the underlying type can be changed.
|
||||
WvCasSessionId androidSessionIdToWidevine(
|
||||
const CasSessionId& android_session_id) {
|
||||
std::string session_id_str(android_session_id.begin(),
|
||||
android_session_id.end());
|
||||
WvCasSessionId wv_session_id = std::atoi(session_id_str.c_str());
|
||||
WvCasSessionId wv_session_id = 0;
|
||||
// CasSessionId is expected to be in little endian order.
|
||||
for (int i = android_session_id.size() - 1; i >= 0; --i) {
|
||||
wv_session_id = (wv_session_id << 8) | android_session_id[i];
|
||||
}
|
||||
return wv_session_id;
|
||||
}
|
||||
|
||||
CasSessionId widevineSessionIdToAndroid(const WvCasSessionId& wv_session_id) {
|
||||
auto wv_session_id_begin = reinterpret_cast<const uint8_t*>(&wv_session_id);
|
||||
CasSessionId android_session_id(wv_session_id_begin,
|
||||
wv_session_id_begin + sizeof(wv_session_id));
|
||||
CasSessionId android_session_id;
|
||||
// CasSessionId is expected to be in little endian order.
|
||||
for (int i = 0; i < static_cast<int>(sizeof(WvCasSessionId)); ++i) {
|
||||
android_session_id.push_back((wv_session_id >> (8 * i)) & 0xff);
|
||||
}
|
||||
return android_session_id;
|
||||
}
|
||||
|
||||
@@ -101,8 +105,11 @@ status_t WidevineCasPlugin::openSession(CasSessionId* sessionId) {
|
||||
if (!status.ok()) {
|
||||
return android::ERROR_CAS_SESSION_NOT_OPENED;
|
||||
}
|
||||
std::string session_id_str = std::to_string(new_session_id);
|
||||
*sessionId = CasSessionId(session_id_str.begin(), session_id_str.end());
|
||||
|
||||
const CasSessionId& android_session_id =
|
||||
widevineSessionIdToAndroid(new_session_id);
|
||||
sessionId->assign(android_session_id.begin(), android_session_id.end());
|
||||
|
||||
// Not a session event, so CasSessionId in callback is null.
|
||||
CallBack(app_data_, CAS_SESSION_ID, new_session_id, nullptr, 0, nullptr);
|
||||
return OK;
|
||||
|
||||
@@ -10,7 +10,7 @@ cc_library_static {
|
||||
proprietary: true,
|
||||
|
||||
srcs: [
|
||||
"ca_descriptor.proto",
|
||||
"media_cas.proto",
|
||||
"device_files.proto",
|
||||
"license_protocol.proto",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user