| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" | 5 #include "chrome/renderer/extensions/cast_streaming_native_handler.h" |
| 6 | 6 |
| 7 #include <functional> | 7 #include <functional> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 cast_params->ssrc = ext_params.ssrc; | 77 cast_params->ssrc = ext_params.ssrc; |
| 78 cast_params->feedback_ssrc = ext_params.feedback_ssrc; | 78 cast_params->feedback_ssrc = ext_params.feedback_ssrc; |
| 79 cast_params->clock_rate = ext_params.clock_rate ? *ext_params.clock_rate : 0; | 79 cast_params->clock_rate = ext_params.clock_rate ? *ext_params.clock_rate : 0; |
| 80 cast_params->min_bitrate = | 80 cast_params->min_bitrate = |
| 81 ext_params.min_bitrate ? *ext_params.min_bitrate : 0; | 81 ext_params.min_bitrate ? *ext_params.min_bitrate : 0; |
| 82 cast_params->max_bitrate = | 82 cast_params->max_bitrate = |
| 83 ext_params.max_bitrate ? *ext_params.max_bitrate : 0; | 83 ext_params.max_bitrate ? *ext_params.max_bitrate : 0; |
| 84 cast_params->channels = ext_params.channels ? *ext_params.channels : 0; | 84 cast_params->channels = ext_params.channels ? *ext_params.channels : 0; |
| 85 cast_params->max_frame_rate = | 85 cast_params->max_frame_rate = |
| 86 ext_params.max_frame_rate ? *ext_params.max_frame_rate : 0.0; | 86 ext_params.max_frame_rate ? *ext_params.max_frame_rate : 0.0; |
| 87 cast_params->width = ext_params.width ? *ext_params.width : 0; | |
| 88 cast_params->height = ext_params.height ? *ext_params.height : 0; | |
| 89 if (ext_params.aes_key && | 87 if (ext_params.aes_key && |
| 90 !HexDecode(*ext_params.aes_key, &cast_params->aes_key)) { | 88 !HexDecode(*ext_params.aes_key, &cast_params->aes_key)) { |
| 91 isolate->ThrowException(v8::Exception::Error( | 89 isolate->ThrowException(v8::Exception::Error( |
| 92 v8::String::NewFromUtf8(isolate, kInvalidAesKey))); | 90 v8::String::NewFromUtf8(isolate, kInvalidAesKey))); |
| 93 return false; | 91 return false; |
| 94 } | 92 } |
| 95 if (ext_params.aes_iv_mask && | 93 if (ext_params.aes_iv_mask && |
| 96 !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) { | 94 !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) { |
| 97 isolate->ThrowException(v8::Exception::Error( | 95 isolate->ThrowException(v8::Exception::Error( |
| 98 v8::String::NewFromUtf8(isolate, kInvalidAesIvMask))); | 96 v8::String::NewFromUtf8(isolate, kInvalidAesIvMask))); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 118 if (cast_params.clock_rate) | 116 if (cast_params.clock_rate) |
| 119 ext_params->clock_rate.reset(new int(cast_params.clock_rate)); | 117 ext_params->clock_rate.reset(new int(cast_params.clock_rate)); |
| 120 if (cast_params.min_bitrate) | 118 if (cast_params.min_bitrate) |
| 121 ext_params->min_bitrate.reset(new int(cast_params.min_bitrate)); | 119 ext_params->min_bitrate.reset(new int(cast_params.min_bitrate)); |
| 122 if (cast_params.max_bitrate) | 120 if (cast_params.max_bitrate) |
| 123 ext_params->max_bitrate.reset(new int(cast_params.max_bitrate)); | 121 ext_params->max_bitrate.reset(new int(cast_params.max_bitrate)); |
| 124 if (cast_params.channels) | 122 if (cast_params.channels) |
| 125 ext_params->channels.reset(new int(cast_params.channels)); | 123 ext_params->channels.reset(new int(cast_params.channels)); |
| 126 if (cast_params.max_frame_rate > 0.0) | 124 if (cast_params.max_frame_rate > 0.0) |
| 127 ext_params->max_frame_rate.reset(new double(cast_params.max_frame_rate)); | 125 ext_params->max_frame_rate.reset(new double(cast_params.max_frame_rate)); |
| 128 if (cast_params.width) | |
| 129 ext_params->width.reset(new int(cast_params.width)); | |
| 130 if (cast_params.height) | |
| 131 ext_params->height.reset(new int(cast_params.height)); | |
| 132 for (size_t i = 0; i < cast_params.codec_specific_params.size(); ++i) { | 126 for (size_t i = 0; i < cast_params.codec_specific_params.size(); ++i) { |
| 133 linked_ptr<CodecSpecificParams> ext_codec_params( | 127 linked_ptr<CodecSpecificParams> ext_codec_params( |
| 134 new CodecSpecificParams()); | 128 new CodecSpecificParams()); |
| 135 FromCastCodecSpecificParams(cast_params.codec_specific_params[i], | 129 FromCastCodecSpecificParams(cast_params.codec_specific_params[i], |
| 136 ext_codec_params.get()); | 130 ext_codec_params.get()); |
| 137 ext_params->codec_specific_params.push_back(ext_codec_params); | 131 ext_params->codec_specific_params.push_back(ext_codec_params); |
| 138 } | 132 } |
| 139 } | 133 } |
| 140 | 134 |
| 141 void FromCastRtpParams(const CastRtpParams& cast_params, | 135 void FromCastRtpParams(const CastRtpParams& cast_params, |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 transport_id); | 604 transport_id); |
| 611 if (iter != udp_transport_map_.end()) | 605 if (iter != udp_transport_map_.end()) |
| 612 return iter->second.get(); | 606 return iter->second.get(); |
| 613 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); | 607 v8::Isolate* isolate = context()->v8_context()->GetIsolate(); |
| 614 isolate->ThrowException(v8::Exception::RangeError( | 608 isolate->ThrowException(v8::Exception::RangeError( |
| 615 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); | 609 v8::String::NewFromUtf8(isolate, kUdpTransportNotFound))); |
| 616 return NULL; | 610 return NULL; |
| 617 } | 611 } |
| 618 | 612 |
| 619 } // namespace extensions | 613 } // namespace extensions |
| OLD | NEW |