Base64 encoding for string input.

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

This change adds 3 new functions for encoding binary data from a C++
string to a base64 encoded ASCII string.

The CDM and protobuf generated code use C++ strings to store binary
data.  These binary strings are commonly converted into a base64
encoded ASCII string for logging and for returning to the app.

This change also cleans up some of the internal components of the
string_conversions library to use several standard library C++11
method.

Bug: 181732604
Test: CE CDM unittests
Change-Id: I547568c6402e011344260f2df2a06e972122ab8a
This commit is contained in:
Alex Dale
2021-03-12 19:27:51 -08:00
parent 30ebbefb40
commit e51f869190
4 changed files with 312 additions and 213 deletions

View File

@@ -954,7 +954,7 @@ int64_t CdmSession::GetDurationRemaining() {
CdmSessionId CdmSession::GenerateSessionId() {
static int session_num = 1;
return SESSION_ID_PREFIX + IntToString(++session_num);
return SESSION_ID_PREFIX + std::to_string(++session_num);
}
bool CdmSession::GenerateKeySetId(bool atsc_mode_enabled,