OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (ret < 0) { | 175 if (ret < 0) { |
176 return ret; | 176 return ret; |
177 } | 177 } |
178 | 178 |
179 ret = Release(); | 179 ret = Release(); |
180 if (ret < 0) { | 180 if (ret < 0) { |
181 return ret; | 181 return ret; |
182 } | 182 } |
183 | 183 |
184 int number_of_streams = NumberOfStreams(*inst); | 184 int number_of_streams = NumberOfStreams(*inst); |
185 bool doing_simulcast = (number_of_streams > 1); | 185 const bool doing_simulcast = (number_of_streams > 1); |
186 | 186 |
187 if (doing_simulcast && !ValidSimulcastResolutions(*inst, number_of_streams)) { | 187 if (doing_simulcast && !ValidSimulcastResolutions(*inst, number_of_streams)) { |
188 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; | 188 return WEBRTC_VIDEO_CODEC_ERR_PARAMETER; |
189 } | 189 } |
190 | 190 |
191 codec_ = *inst; | 191 codec_ = *inst; |
192 | 192 |
193 // Special mode when screensharing on a single stream. | 193 // Special mode when screensharing on a single stream. |
194 if (number_of_streams == 1 && inst->mode == kScreensharing) { | 194 if (number_of_streams == 1 && inst->mode == kScreensharing) { |
195 screensharing_tl_factory_.reset(new ScreenshareTemporalLayersFactory()); | 195 screensharing_tl_factory_.reset(new ScreenshareTemporalLayersFactory()); |
(...skipping 27 matching lines...) Expand all Loading... |
223 return ret; | 223 return ret; |
224 } | 224 } |
225 EncodedImageCallback* callback = new AdapterEncodedImageCallback(this, i); | 225 EncodedImageCallback* callback = new AdapterEncodedImageCallback(this, i); |
226 encoder->RegisterEncodeCompleteCallback(callback); | 226 encoder->RegisterEncodeCompleteCallback(callback); |
227 streaminfos_.push_back(StreamInfo(encoder, callback, stream_codec.width, | 227 streaminfos_.push_back(StreamInfo(encoder, callback, stream_codec.width, |
228 stream_codec.height, send_stream)); | 228 stream_codec.height, send_stream)); |
229 if (i != 0) | 229 if (i != 0) |
230 implementation_name += ", "; | 230 implementation_name += ", "; |
231 implementation_name += streaminfos_[i].encoder->ImplementationName(); | 231 implementation_name += streaminfos_[i].encoder->ImplementationName(); |
232 } | 232 } |
233 implementation_name_ = | 233 if (doing_simulcast) { |
234 "SimulcastEncoderAdapter (" + implementation_name + ")"; | 234 implementation_name_ = |
| 235 "SimulcastEncoderAdapter (" + implementation_name + ")"; |
| 236 } else { |
| 237 implementation_name_ = implementation_name; |
| 238 } |
235 return WEBRTC_VIDEO_CODEC_OK; | 239 return WEBRTC_VIDEO_CODEC_OK; |
236 } | 240 } |
237 | 241 |
238 int SimulcastEncoderAdapter::Encode( | 242 int SimulcastEncoderAdapter::Encode( |
239 const VideoFrame& input_image, | 243 const VideoFrame& input_image, |
240 const CodecSpecificInfo* codec_specific_info, | 244 const CodecSpecificInfo* codec_specific_info, |
241 const std::vector<FrameType>* frame_types) { | 245 const std::vector<FrameType>* frame_types) { |
242 if (!Initialized()) { | 246 if (!Initialized()) { |
243 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 247 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
244 } | 248 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (streaminfos_.size() != 1) | 505 if (streaminfos_.size() != 1) |
502 return false; | 506 return false; |
503 return streaminfos_[0].encoder->SupportsNativeHandle(); | 507 return streaminfos_[0].encoder->SupportsNativeHandle(); |
504 } | 508 } |
505 | 509 |
506 const char* SimulcastEncoderAdapter::ImplementationName() const { | 510 const char* SimulcastEncoderAdapter::ImplementationName() const { |
507 return implementation_name_.c_str(); | 511 return implementation_name_.c_str(); |
508 } | 512 } |
509 | 513 |
510 } // namespace webrtc | 514 } // namespace webrtc |
OLD | NEW |