diff options
-rw-r--r-- | chrome/common/extensions/api/cast_streaming_rtp_stream.idl | 4 | ||||
-rw-r--r-- | chrome/renderer/extensions/cast_streaming_native_handler.cc | 17 | ||||
-rw-r--r-- | chrome/renderer/media/cast_rtp_stream.cc | 4 |
3 files changed, 19 insertions, 6 deletions
diff --git a/chrome/common/extensions/api/cast_streaming_rtp_stream.idl b/chrome/common/extensions/api/cast_streaming_rtp_stream.idl index f1bae6e..afada05 100644 --- a/chrome/common/extensions/api/cast_streaming_rtp_stream.idl +++ b/chrome/common/extensions/api/cast_streaming_rtp_stream.idl @@ -48,10 +48,10 @@ namespace cast.streaming.rtpStream { // Video height in pixels. long? height; - // 16 bytes AES key encoded in Base64. + // 32 bytes hex-encoded AES key. DOMString? aesKey; - // 16 bytes AES IV (Initialization vector) mask encoded in Base64. + // 32 bytes hex-encoded AES IV (Initialization vector) mask. DOMString? aesIvMask; // A list of codec specific params. 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; diff --git a/chrome/renderer/media/cast_rtp_stream.cc b/chrome/renderer/media/cast_rtp_stream.cc index 9344dc5..99a8543 100644 --- a/chrome/renderer/media/cast_rtp_stream.cc +++ b/chrome/renderer/media/cast_rtp_stream.cc @@ -154,6 +154,8 @@ bool ToAudioSenderConfig(const CastRtpParams& params, config->incoming_feedback_ssrc = params.payload.feedback_ssrc; config->rtp_config.payload_type = params.payload.payload_type; config->rtp_config.max_delay_ms = params.payload.max_latency_ms; + config->rtp_config.aes_key = params.payload.aes_key; + config->rtp_config.aes_iv_mask = params.payload.aes_iv_mask; config->use_external_encoder = false; config->frequency = params.payload.clock_rate; config->channels = params.payload.channels; @@ -172,6 +174,8 @@ bool ToVideoSenderConfig(const CastRtpParams& params, config->incoming_feedback_ssrc = params.payload.feedback_ssrc; config->rtp_config.payload_type = params.payload.payload_type; config->rtp_config.max_delay_ms = params.payload.max_latency_ms; + config->rtp_config.aes_key = params.payload.aes_key; + config->rtp_config.aes_iv_mask = params.payload.aes_iv_mask; config->use_external_encoder = false; config->width = params.payload.width; config->height = params.payload.height; |