| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 encoder->RegisterEncodeCompleteCallback(callback); | 225 encoder->RegisterEncodeCompleteCallback(callback); |
| 226 streaminfos_.push_back(StreamInfo(encoder, callback, stream_codec.width, | 226 streaminfos_.push_back(StreamInfo(encoder, callback, stream_codec.width, |
| 227 stream_codec.height, send_stream)); | 227 stream_codec.height, send_stream)); |
| 228 } | 228 } |
| 229 return WEBRTC_VIDEO_CODEC_OK; | 229 return WEBRTC_VIDEO_CODEC_OK; |
| 230 } | 230 } |
| 231 | 231 |
| 232 int SimulcastEncoderAdapter::Encode( | 232 int SimulcastEncoderAdapter::Encode( |
| 233 const VideoFrame& input_image, | 233 const VideoFrame& input_image, |
| 234 const CodecSpecificInfo* codec_specific_info, | 234 const CodecSpecificInfo* codec_specific_info, |
| 235 const std::vector<VideoFrameType>* frame_types) { | 235 const std::vector<FrameType>* frame_types) { |
| 236 if (!Initialized()) { | 236 if (!Initialized()) { |
| 237 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 237 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
| 238 } | 238 } |
| 239 if (encoded_complete_callback_ == NULL) { | 239 if (encoded_complete_callback_ == NULL) { |
| 240 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; | 240 return WEBRTC_VIDEO_CODEC_UNINITIALIZED; |
| 241 } | 241 } |
| 242 | 242 |
| 243 // All active streams should generate a key frame if | 243 // All active streams should generate a key frame if |
| 244 // a key frame is requested by any stream. | 244 // a key frame is requested by any stream. |
| 245 bool send_key_frame = false; | 245 bool send_key_frame = false; |
| 246 if (frame_types) { | 246 if (frame_types) { |
| 247 for (size_t i = 0; i < frame_types->size(); ++i) { | 247 for (size_t i = 0; i < frame_types->size(); ++i) { |
| 248 if (frame_types->at(i) == kKeyFrame) { | 248 if (frame_types->at(i) == kKeyFrame) { |
| 249 send_key_frame = true; | 249 send_key_frame = true; |
| 250 break; | 250 break; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { | 254 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { |
| 255 if (streaminfos_[stream_idx].key_frame_request && | 255 if (streaminfos_[stream_idx].key_frame_request && |
| 256 streaminfos_[stream_idx].send_stream) { | 256 streaminfos_[stream_idx].send_stream) { |
| 257 send_key_frame = true; | 257 send_key_frame = true; |
| 258 break; | 258 break; |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 | 261 |
| 262 int src_width = input_image.width(); | 262 int src_width = input_image.width(); |
| 263 int src_height = input_image.height(); | 263 int src_height = input_image.height(); |
| 264 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { | 264 for (size_t stream_idx = 0; stream_idx < streaminfos_.size(); ++stream_idx) { |
| 265 std::vector<VideoFrameType> stream_frame_types; | 265 std::vector<FrameType> stream_frame_types; |
| 266 if (send_key_frame) { | 266 if (send_key_frame) { |
| 267 stream_frame_types.push_back(kKeyFrame); | 267 stream_frame_types.push_back(kKeyFrame); |
| 268 streaminfos_[stream_idx].key_frame_request = false; | 268 streaminfos_[stream_idx].key_frame_request = false; |
| 269 } else { | 269 } else { |
| 270 stream_frame_types.push_back(kDeltaFrame); | 270 stream_frame_types.push_back(kDeltaFrame); |
| 271 } | 271 } |
| 272 | 272 |
| 273 int dst_width = streaminfos_[stream_idx].width; | 273 int dst_width = streaminfos_[stream_idx].width; |
| 274 int dst_height = streaminfos_[stream_idx].height; | 274 int dst_height = streaminfos_[stream_idx].height; |
| 275 // If scaling isn't required, because the input resolution | 275 // If scaling isn't required, because the input resolution |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 502 |
| 503 void SimulcastEncoderAdapter::OnDroppedFrame() { | 503 void SimulcastEncoderAdapter::OnDroppedFrame() { |
| 504 streaminfos_[0].encoder->OnDroppedFrame(); | 504 streaminfos_[0].encoder->OnDroppedFrame(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 int SimulcastEncoderAdapter::GetTargetFramerate() { | 507 int SimulcastEncoderAdapter::GetTargetFramerate() { |
| 508 return streaminfos_[0].encoder->GetTargetFramerate(); | 508 return streaminfos_[0].encoder->GetTargetFramerate(); |
| 509 } | 509 } |
| 510 | 510 |
| 511 } // namespace webrtc | 511 } // namespace webrtc |
| OLD | NEW |