1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Replace base64 to match MIT license. 3.0.32

This commit is contained in:
winlin 2018-07-22 17:56:38 +08:00
parent 0a63448b86
commit 84f81983aa
7 changed files with 117 additions and 235 deletions

View file

@ -583,23 +583,16 @@ srs_error_t SrsRtspSdp::parse_control_attribute(string attr)
return err;
}
string SrsRtspSdp::base64_decode(string value)
string SrsRtspSdp::base64_decode(string cipher)
{
if (value.empty()) {
if (cipher.empty()) {
return "";
}
int nb_output = (int)(value.length() * 2);
uint8_t* output = new uint8_t[nb_output];
SrsAutoFreeA(uint8_t, output);
string plaintext;
srs_error_t err = srs_av_base64_decode(cipher, plaintext);
srs_freep(err);
int ret = srs_av_base64_decode(output, (char*)value.c_str(), nb_output);
if (ret <= 0) {
return "";
}
std::string plaintext;
plaintext.append((char*)output, ret);
return plaintext;
}