diff --git a/packager/hls/base/simple_hls_notifier.cc b/packager/hls/base/simple_hls_notifier.cc index 6406933184..860323629c 100644 --- a/packager/hls/base/simple_hls_notifier.cc +++ b/packager/hls/base/simple_hls_notifier.cc @@ -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\"," diff --git a/packager/hls/base/simple_hls_notifier.h b/packager/hls/base/simple_hls_notifier.h index bd0217c59c..2336afaf22 100644 --- a/packager/hls/base/simple_hls_notifier.h +++ b/packager/hls/base/simple_hls_notifier.h @@ -7,6 +7,10 @@ #ifndef PACKAGER_HLS_BASE_SIMPLE_HLS_NOTIFIER_H_ #define PACKAGER_HLS_BASE_SIMPLE_HLS_NOTIFIER_H_ +#include +#include +#include + #include "packager/base/atomic_sequence_num.h" #include "packager/base/macros.h" #include "packager/base/memory/scoped_ptr.h" diff --git a/packager/hls/base/simple_hls_notifier_unittest.cc b/packager/hls/base/simple_hls_notifier_unittest.cc index 7ebc21f714..25dbc8885b 100644 --- a/packager/hls/base/simple_hls_notifier_unittest.cc +++ b/packager/hls/base/simple_hls_notifier_unittest.cc @@ -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 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 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 pssh_data(widevine_pssh_data_str.begin(), widevine_pssh_data_str.end());