Add level 3 libs and address build warnings

* Fix strict aliasing error in gcc

  [ Merge of http://go/wvgerrit/15856 ]

  This also ensures the alignment of 64-bit memory access in a portable
  way, without using compiler-specific mechanisms like attributes or
  platform-specific mechanisms like memalign.

  (The aliasing error does not show up in clang.)

* Return kNotSupported for non-Widevine init data

  [ Merge of http://go/wvgerrit/15853 ]

  This also improves logging for the init data parser by including a
  verbose message for non-Widevine PSSHs and by using a new IsEOF()
  method to avoid misleading "Unable to read atom size" logs.

* Cast RSA_size() to int

  [ Merge of http://go/wvgerrit/15880 ]

  It has been suggested that this may be unsigned on some versions of
  OpenSSL or BoringSSL.

* Be strict about warnings for CE CDM

  [ Merge of http://go/wvgerrit/15831 ]

  * Enable all warnings and treat warnings as errors in the CE build.
  * Fix all existing warnings (mostly unused variables, consts, and
  functions, and one signed/unsigned comparison).
  * Exclude protobuf warnings rather than maintain a divergent copy.

* Fix release build errors

  [ Merge of http://go/wvgerrit/15855 ]

* Level 3 Build With Android Emulator

  [ Merge of http://go/wvgerrit/15778 ]

  This CL rebuilds the level 3 libraries with the android emulator
  sdk_phone_*.  This seems to avoid problems with the x86 build using
  incorrect compiler flags.

  These libraries work for arm, x86, mips, arm64, and x86_64.  The level
  3 library is disabled for mips64.

  Versions:
  level3/mips/libwvlevel3.a  Level3 Library Sep 30 2015 18:29:50
  level3/arm/libwvlevel3.a  Level3 Library Sep 28 2015 13:18:25
  level3/x86/libwvlevel3.a  Level3 Library Sep 28 2015 13:08:28

Change-Id: I1e50aa78bdc84ecb905f2e55297d4f48b140341c
This commit is contained in:
Rahul Frias
2015-10-07 11:07:43 -07:00
parent f19bb98fb0
commit 072cf7e711
13 changed files with 333 additions and 259 deletions

View File

@@ -26,7 +26,8 @@ class BufferReader {
BufferReader(const uint8_t* buf, size_t size)
: buf_(buf), size_(buf != NULL ? size : 0), pos_(0) {}
bool HasBytes(size_t count) { return (pos() + count <= size()); }
bool HasBytes(size_t count) const { return pos_ + count <= size_; }
bool IsEOF() const { return pos_ >= size_; }
// Read a value from the stream, performing endian correction,
// and advance the stream pointer.

View File

@@ -48,6 +48,7 @@ CdmSession::CdmSession(CdmClientPropertySet* cdm_client_property_set,
key_set_id_ = *forced_session_id;
} else {
bool ok = GenerateKeySetId(&key_set_id_);
(void)ok; // ok is now used when assertions are turned off.
assert(ok);
}
session_id_ = key_set_id_;

View File

@@ -55,7 +55,7 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
// (optional, if version == 1) K * 16 byte key ID.
// 4 byte size of PSSH data, exclusive. (N)
// N byte PSSH data.
while (1) {
while (!reader.IsEOF()) {
size_t start_pos = reader.pos();
// atom size, used for skipping.
@@ -128,6 +128,7 @@ bool InitializationData::ExtractWidevinePssh(const CdmInitData& init_data,
"the atom.");
return false;
}
LOGV("CdmEngine::ExtractWidevinePssh: Skipping non-Widevine PSSH.");
continue;
}

View File

@@ -230,7 +230,6 @@ TEST_F(CdmSessionTest, ReInitFail) {
}
TEST_F(CdmSessionTest, InitFailCryptoError) {
CdmSecurityLevel level = kSecurityLevelL1;
EXPECT_CALL(*crypto_session_, Open(Eq(kLevelDefault)))
.WillOnce(Return(UNKNOWN_ERROR));

View File

@@ -1469,7 +1469,6 @@ class DeviceFilesTest : public ::testing::Test {
CdmAppParameterMap app_parameters;
size_t start_pos = 0;
size_t len = str.length();
bool more = true;
while (start_pos < len) {
size_t name_end_pos = str.find(' ', start_pos);
if (name_end_pos == std::string::npos) return app_parameters;
@@ -1841,7 +1840,6 @@ TEST_F(DeviceFilesTest, RetrieveLicenses) {
DeviceFiles device_files;
EXPECT_TRUE(device_files.Init(kSecurityLevelL1));
device_files.SetTestFile(&file);
DeviceFiles::LicenseState license_state;
CdmInitData pssh_data;
CdmKeyMessage key_request;
CdmKeyResponse key_response;

View File

@@ -47,6 +47,7 @@ SSL_CTX* InitSslContext() {
return ctx;
}
#if 0
// unused, may be useful for debugging SSL-related issues.
void ShowServerCertificate(const SSL* ssl) {
// gets the server certificate
@@ -64,6 +65,7 @@ void ShowServerCertificate(const SSL* ssl) {
LOGE("Failed to get server certificate");
}
}
#endif
// Wait for a socket to be ready for reading or writing.
// Establishing a connection counts as "ready for write".

View File

@@ -16,7 +16,6 @@ namespace wvcdm {
namespace {
const uint32_t kAesBlockSize = 16;
const std::string kAesKey = a2bs_hex("000102030405060708090a0b0c0d0e0f");
const std::string kAesIv = a2bs_hex("000102030405060708090a0b0c0d0e0f");
const std::string kCencInitDataHdr = a2bs_hex(