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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 cast_params->ssrc = ext_params.ssrc; | 91 cast_params->ssrc = ext_params.ssrc; |
92 cast_params->feedback_ssrc = ext_params.feedback_ssrc; | 92 cast_params->feedback_ssrc = ext_params.feedback_ssrc; |
93 cast_params->clock_rate = ext_params.clock_rate ? *ext_params.clock_rate : 0; | 93 cast_params->clock_rate = ext_params.clock_rate ? *ext_params.clock_rate : 0; |
94 cast_params->min_bitrate = | 94 cast_params->min_bitrate = |
95 ext_params.min_bitrate ? *ext_params.min_bitrate : 0; | 95 ext_params.min_bitrate ? *ext_params.min_bitrate : 0; |
96 cast_params->max_bitrate = | 96 cast_params->max_bitrate = |
97 ext_params.max_bitrate ? *ext_params.max_bitrate : 0; | 97 ext_params.max_bitrate ? *ext_params.max_bitrate : 0; |
98 cast_params->channels = ext_params.channels ? *ext_params.channels : 0; | 98 cast_params->channels = ext_params.channels ? *ext_params.channels : 0; |
99 cast_params->max_frame_rate = | 99 cast_params->max_frame_rate = |
100 ext_params.max_frame_rate ? *ext_params.max_frame_rate : 0.0; | 100 ext_params.max_frame_rate ? *ext_params.max_frame_rate : 0.0; |
101 cast_params->width = ext_params.width ? *ext_params.width : 0; | |
102 cast_params->height = ext_params.height ? *ext_params.height : 0; | |
103 if (ext_params.aes_key && | 101 if (ext_params.aes_key && |
104 !HexDecode(*ext_params.aes_key, &cast_params->aes_key)) { | 102 !HexDecode(*ext_params.aes_key, &cast_params->aes_key)) { |
105 isolate->ThrowException(v8::Exception::Error( | 103 isolate->ThrowException(v8::Exception::Error( |
106 v8::String::NewFromUtf8(isolate, kInvalidAesKey))); | 104 v8::String::NewFromUtf8(isolate, kInvalidAesKey))); |
107 return false; | 105 return false; |
108 } | 106 } |
109 if (ext_params.aes_iv_mask && | 107 if (ext_params.aes_iv_mask && |
110 !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) { | 108 !HexDecode(*ext_params.aes_iv_mask, &cast_params->aes_iv_mask)) { |
111 isolate->ThrowException(v8::Exception::Error( | 109 isolate->ThrowException(v8::Exception::Error( |
112 v8::String::NewFromUtf8(isolate, kInvalidAesIvMask))); | 110 v8::String::NewFromUtf8(isolate, kInvalidAesIvMask))); |
(...skipping 19 matching lines...) Expand all Loading... |
132 if (cast_params.clock_rate) | 130 if (cast_params.clock_rate) |
133 ext_params->clock_rate.reset(new int(cast_params.clock_rate)); | 131 ext_params->clock_rate.reset(new int(cast_params.clock_rate)); |
134 if (cast_params.min_bitrate) | 132 if (cast_params.min_bitrate) |
135 ext_params->min_bitrate.reset(new int(cast_params.min_bitrate)); | 133 ext_params->min_bitrate.reset(new int(cast_params.min_bitrate)); |
136 if (cast_params.max_bitrate) | 134 if (cast_params.max_bitrate) |
137 ext_params->max_bitrate.reset(new int(cast_params.max_bitrate)); | 135 ext_params->max_bitrate.reset(new int(cast_params.max_bitrate)); |
138 if (cast_params.channels) | 136 if (cast_params.channels) |
139 ext_params->channels.reset(new int(cast_params.channels)); | 137 ext_params->channels.reset(new int(cast_params.channels)); |
140 if (cast_params.max_frame_rate > 0.0) | 138 if (cast_params.max_frame_rate > 0.0) |
141 ext_params->max_frame_rate.reset(new double(cast_params.max_frame_rate)); | 139 ext_params->max_frame_rate.reset(new double(cast_params.max_frame_rate)); |
142 if (cast_params.width) | |
143 ext_params->width.reset(new int(cast_params.width)); | |
144 if (cast_params.height) | |
145 ext_params->height.reset(new int(cast_params.height)); | |
146 for (size_t i = 0; i < cast_params.codec_specific_params.size(); ++i) { | 140 for (size_t i = 0; i < cast_params.codec_specific_params.size(); ++i) { |
147 linked_ptr<CodecSpecificParams> ext_codec_params( | 141 linked_ptr<CodecSpecificParams> ext_codec_params( |
148 new CodecSpecificParams()); | 142 new CodecSpecificParams()); |
149 FromCastCodecSpecificParams(cast_params.codec_specific_params[i], | 143 FromCastCodecSpecificParams(cast_params.codec_specific_params[i], |
150 ext_codec_params.get()); | 144 ext_codec_params.get()); |
151 ext_params->codec_specific_params.push_back(ext_codec_params); | 145 ext_params->codec_specific_params.push_back(ext_codec_params); |
152 } | 146 } |
153 } | 147 } |
154 | 148 |
155 void FromCastRtpParams(const CastRtpParams& cast_params, | 149 void FromCastRtpParams(const CastRtpParams& cast_params, |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 void CastStreamingNativeHandler::AddTracksToMediaStream( | 849 void CastStreamingNativeHandler::AddTracksToMediaStream( |
856 const std::string& url, | 850 const std::string& url, |
857 const media::AudioParameters& params, | 851 const media::AudioParameters& params, |
858 scoped_refptr<media::AudioCapturerSource> audio, | 852 scoped_refptr<media::AudioCapturerSource> audio, |
859 scoped_ptr<media::VideoCapturerSource> video) { | 853 scoped_ptr<media::VideoCapturerSource> video) { |
860 content::AddAudioTrackToMediaStream(audio, params, true, true, url); | 854 content::AddAudioTrackToMediaStream(audio, params, true, true, url); |
861 content::AddVideoTrackToMediaStream(video.Pass(), true, true, url); | 855 content::AddVideoTrackToMediaStream(video.Pass(), true, true, url); |
862 } | 856 } |
863 | 857 |
864 } // namespace extensions | 858 } // namespace extensions |
OLD | NEW |