summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/cast_streaming_native_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer/extensions/cast_streaming_native_handler.cc')
-rw-r--r--chrome/renderer/extensions/cast_streaming_native_handler.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/chrome/renderer/extensions/cast_streaming_native_handler.cc b/chrome/renderer/extensions/cast_streaming_native_handler.cc
index 424ba05..c3fee5b 100644
--- a/chrome/renderer/extensions/cast_streaming_native_handler.cc
+++ b/chrome/renderer/extensions/cast_streaming_native_handler.cc
@@ -7,9 +7,9 @@
#include <functional>
#include <iterator>
-#include "base/base64.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/api/cast_streaming_rtp_stream.h"
#include "chrome/common/extensions/api/cast_streaming_udp_transport.h"
#include "chrome/renderer/media/cast_rtp_stream.h"
@@ -55,6 +55,16 @@ void FromCastCodecSpecificParams(const CastCodecSpecificParams& cast_params,
ext_params->value = cast_params.value;
}
+namespace {
+bool HexDecode(const std::string& input, std::string* output) {
+ std::vector<uint8> bytes;
+ if (!base::HexStringToBytes(input, &bytes))
+ return false;
+ output->assign(reinterpret_cast<const char*>(&bytes[0]), bytes.size());
+ return true;
+}
+} // namespace
+
bool ToCastRtpPayloadParamsOrThrow(v8::Isolate* isolate,
const RtpPayloadParams& ext_params,
CastRtpPayloadParams* cast_params) {
@@ -72,14 +82,13 @@ bool ToCastRtpPayloadParamsOrThrow(v8::Isolate* isolate,
cast_params->width = ext_params.width ? *ext_params.width : 0;
cast_params->height = ext_params.height ? *ext_params.height : 0;
if (ext_params.aes_key &&
- !base::Base64Decode(*ext_params.aes_key, &cast_params->aes_key)) {
+ !HexDecode(*ext_params.aes_key, &cast_params->aes_key)) {
isolate->ThrowException(v8::Exception::Error(
v8::String::NewFromUtf8(isolate, kInvalidAesKey)));
return false;
}
if (ext_params.aes_iv_mask &&
- !base::Base64Decode(*ext_params.aes_iv_mask,
- &cast_params->aes_iv_mask)) {
+ !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) {
isolate->ThrowException(v8::Exception::Error(
v8::String::NewFromUtf8(isolate, kInvalidAesIvMask)));
return false;