More cleanup in proto usage

Change-Id: If35f95dbff47bc9e8c1c42cb56d75719367abfc0
This commit is contained in:
Kongqun Yang 2016-05-19 16:43:13 -07:00 committed by KongQun Yang
parent 4f9c8ea781
commit 7e533ec5ca
3 changed files with 13 additions and 7 deletions

View File

@ -136,7 +136,9 @@ bool SimpleHlsNotifier::NotifyEncryptionUpdate(
}
std::string content_id_base64;
base::Base64Encode(pssh_data.content_id(), &content_id_base64);
base::Base64Encode(base::StringPiece(pssh_data.content_id().data(),
pssh_data.content_id().size()),
&content_id_base64);
std::string json_format = base::StringPrintf(
"{"
"\"provider\":\"%s\","

View File

@ -7,6 +7,10 @@
#ifndef PACKAGER_HLS_BASE_SIMPLE_HLS_NOTIFIER_H_
#define PACKAGER_HLS_BASE_SIMPLE_HLS_NOTIFIER_H_
#include <map>
#include <string>
#include <vector>
#include "packager/base/atomic_sequence_num.h"
#include "packager/base/macros.h"
#include "packager/base/memory/scoped_ptr.h"

View File

@ -185,8 +185,8 @@ TEST_F(SimpleHlsNotifierTest, NotifyEncryptionUpdate) {
};
widevine_pssh_data.add_key_id()->assign(kAnyKeyId,
kAnyKeyId + arraysize(kAnyKeyId));
std::string widevine_pssh_data_str;
ASSERT_TRUE(widevine_pssh_data.SerializeToString(&widevine_pssh_data_str));
std::string widevine_pssh_data_str = widevine_pssh_data.SerializeAsString();
EXPECT_TRUE(!widevine_pssh_data_str.empty());
std::vector<uint8_t> pssh_data(widevine_pssh_data_str.begin(),
widevine_pssh_data_str.end());
@ -255,8 +255,8 @@ TEST_F(SimpleHlsNotifierTest, MultipleKeyIdsInPssh) {
kFirstKeyId + arraysize(kFirstKeyId));
widevine_pssh_data.add_key_id()->assign(
kSecondKeyId, kSecondKeyId + arraysize(kSecondKeyId));
std::string widevine_pssh_data_str;
ASSERT_TRUE(widevine_pssh_data.SerializeToString(&widevine_pssh_data_str));
std::string widevine_pssh_data_str = widevine_pssh_data.SerializeAsString();
EXPECT_TRUE(!widevine_pssh_data_str.empty());
std::vector<uint8_t> pssh_data(widevine_pssh_data_str.begin(),
widevine_pssh_data_str.end());
@ -320,8 +320,8 @@ TEST_F(SimpleHlsNotifierTest, NotifyEncryptionUpdateEmptyIv) {
};
widevine_pssh_data.add_key_id()->assign(kAnyKeyId,
kAnyKeyId + arraysize(kAnyKeyId));
std::string widevine_pssh_data_str;
ASSERT_TRUE(widevine_pssh_data.SerializeToString(&widevine_pssh_data_str));
std::string widevine_pssh_data_str = widevine_pssh_data.SerializeAsString();
EXPECT_TRUE(!widevine_pssh_data_str.empty());
std::vector<uint8_t> pssh_data(widevine_pssh_data_str.begin(),
widevine_pssh_data_str.end());