| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return false; | 117 return false; |
| 118 } | 118 } |
| 119 if (ext_params.aes_iv_mask && | 119 if (ext_params.aes_iv_mask && |
| 120 !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) { | 120 !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) { |
| 121 isolate->ThrowException(v8::Exception::Error( | 121 isolate->ThrowException(v8::Exception::Error( |
| 122 v8::String::NewFromUtf8(isolate, kInvalidAesIvMask))); | 122 v8::String::NewFromUtf8(isolate, kInvalidAesIvMask))); |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 for (size_t i = 0; i < ext_params.codec_specific_params.size(); ++i) { | 125 for (size_t i = 0; i < ext_params.codec_specific_params.size(); ++i) { |
| 126 CastCodecSpecificParams cast_codec_params; | 126 CastCodecSpecificParams cast_codec_params; |
| 127 ToCastCodecSpecificParams(*ext_params.codec_specific_params[i], | 127 ToCastCodecSpecificParams(ext_params.codec_specific_params[i], |
| 128 &cast_codec_params); | 128 &cast_codec_params); |
| 129 cast_params->codec_specific_params.push_back(cast_codec_params); | 129 cast_params->codec_specific_params.push_back(cast_codec_params); |
| 130 } | 130 } |
| 131 return true; | 131 return true; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void FromCastRtpPayloadParams(const CastRtpPayloadParams& cast_params, | 134 void FromCastRtpPayloadParams(const CastRtpPayloadParams& cast_params, |
| 135 RtpPayloadParams* ext_params) { | 135 RtpPayloadParams* ext_params) { |
| 136 ext_params->payload_type = cast_params.payload_type; | 136 ext_params->payload_type = cast_params.payload_type; |
| 137 ext_params->max_latency = cast_params.max_latency_ms; | 137 ext_params->max_latency = cast_params.max_latency_ms; |
| 138 ext_params->min_latency.reset(new int(cast_params.min_latency_ms)); | 138 ext_params->min_latency.reset(new int(cast_params.min_latency_ms)); |
| 139 ext_params->animated_latency.reset(new int(cast_params.animated_latency_ms)); | 139 ext_params->animated_latency.reset(new int(cast_params.animated_latency_ms)); |
| 140 ext_params->codec_name = cast_params.codec_name; | 140 ext_params->codec_name = cast_params.codec_name; |
| 141 ext_params->ssrc = cast_params.ssrc; | 141 ext_params->ssrc = cast_params.ssrc; |
| 142 ext_params->feedback_ssrc = cast_params.feedback_ssrc; | 142 ext_params->feedback_ssrc = cast_params.feedback_ssrc; |
| 143 if (cast_params.clock_rate) | 143 if (cast_params.clock_rate) |
| 144 ext_params->clock_rate.reset(new int(cast_params.clock_rate)); | 144 ext_params->clock_rate.reset(new int(cast_params.clock_rate)); |
| 145 if (cast_params.min_bitrate) | 145 if (cast_params.min_bitrate) |
| 146 ext_params->min_bitrate.reset(new int(cast_params.min_bitrate)); | 146 ext_params->min_bitrate.reset(new int(cast_params.min_bitrate)); |
| 147 if (cast_params.max_bitrate) | 147 if (cast_params.max_bitrate) |
| 148 ext_params->max_bitrate.reset(new int(cast_params.max_bitrate)); | 148 ext_params->max_bitrate.reset(new int(cast_params.max_bitrate)); |
| 149 if (cast_params.channels) | 149 if (cast_params.channels) |
| 150 ext_params->channels.reset(new int(cast_params.channels)); | 150 ext_params->channels.reset(new int(cast_params.channels)); |
| 151 if (cast_params.max_frame_rate > 0.0) | 151 if (cast_params.max_frame_rate > 0.0) |
| 152 ext_params->max_frame_rate.reset(new double(cast_params.max_frame_rate)); | 152 ext_params->max_frame_rate.reset(new double(cast_params.max_frame_rate)); |
| 153 for (size_t i = 0; i < cast_params.codec_specific_params.size(); ++i) { | 153 for (size_t i = 0; i < cast_params.codec_specific_params.size(); ++i) { |
| 154 linked_ptr<CodecSpecificParams> ext_codec_params( | 154 CodecSpecificParams ext_codec_params; |
| 155 new CodecSpecificParams()); | |
| 156 FromCastCodecSpecificParams(cast_params.codec_specific_params[i], | 155 FromCastCodecSpecificParams(cast_params.codec_specific_params[i], |
| 157 ext_codec_params.get()); | 156 &ext_codec_params); |
| 158 ext_params->codec_specific_params.push_back(ext_codec_params); | 157 ext_params->codec_specific_params.push_back(std::move(ext_codec_params)); |
| 159 } | 158 } |
| 160 } | 159 } |
| 161 | 160 |
| 162 void FromCastRtpParams(const CastRtpParams& cast_params, | 161 void FromCastRtpParams(const CastRtpParams& cast_params, |
| 163 RtpParams* ext_params) { | 162 RtpParams* ext_params) { |
| 164 std::copy(cast_params.rtcp_features.begin(), | 163 std::copy(cast_params.rtcp_features.begin(), |
| 165 cast_params.rtcp_features.end(), | 164 cast_params.rtcp_features.end(), |
| 166 std::back_inserter(ext_params->rtcp_features)); | 165 std::back_inserter(ext_params->rtcp_features)); |
| 167 FromCastRtpPayloadParams(cast_params.payload, &ext_params->payload); | 166 FromCastRtpPayloadParams(cast_params.payload, &ext_params->payload); |
| 168 } | 167 } |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 LOG(ERROR) << "Failed to add Cast audio track to media stream."; | 875 LOG(ERROR) << "Failed to add Cast audio track to media stream."; |
| 877 } | 876 } |
| 878 if (!content::AddVideoTrackToMediaStream(std::move(video), true, // is_remote | 877 if (!content::AddVideoTrackToMediaStream(std::move(video), true, // is_remote |
| 879 true, // is_readonly | 878 true, // is_readonly |
| 880 &web_stream)) { | 879 &web_stream)) { |
| 881 LOG(ERROR) << "Failed to add Cast video track to media stream."; | 880 LOG(ERROR) << "Failed to add Cast video track to media stream."; |
| 882 } | 881 } |
| 883 } | 882 } |
| 884 | 883 |
| 885 } // namespace extensions | 884 } // namespace extensions |
| OLD | NEW |