| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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     // Don't encode frames in resolutions that we don't intend to send. | 
|  | 266     if (!streaminfos_[stream_idx].send_stream) | 
|  | 267       continue; | 
|  | 268 | 
| 265     std::vector<VideoFrameType> stream_frame_types; | 269     std::vector<VideoFrameType> stream_frame_types; | 
| 266     if (send_key_frame) { | 270     if (send_key_frame) { | 
| 267       stream_frame_types.push_back(kKeyFrame); | 271       stream_frame_types.push_back(kKeyFrame); | 
| 268       streaminfos_[stream_idx].key_frame_request = false; | 272       streaminfos_[stream_idx].key_frame_request = false; | 
| 269     } else { | 273     } else { | 
| 270       stream_frame_types.push_back(kDeltaFrame); | 274       stream_frame_types.push_back(kDeltaFrame); | 
| 271     } | 275     } | 
| 272 | 276 | 
| 273     int dst_width = streaminfos_[stream_idx].width; | 277     int dst_width = streaminfos_[stream_idx].width; | 
| 274     int dst_height = streaminfos_[stream_idx].height; | 278     int dst_height = streaminfos_[stream_idx].height; | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 383 | 387 | 
| 384 int32_t SimulcastEncoderAdapter::Encoded( | 388 int32_t SimulcastEncoderAdapter::Encoded( | 
| 385     size_t stream_idx, | 389     size_t stream_idx, | 
| 386     const EncodedImage& encodedImage, | 390     const EncodedImage& encodedImage, | 
| 387     const CodecSpecificInfo* codecSpecificInfo, | 391     const CodecSpecificInfo* codecSpecificInfo, | 
| 388     const RTPFragmentationHeader* fragmentation) { | 392     const RTPFragmentationHeader* fragmentation) { | 
| 389   CodecSpecificInfo stream_codec_specific = *codecSpecificInfo; | 393   CodecSpecificInfo stream_codec_specific = *codecSpecificInfo; | 
| 390   CodecSpecificInfoVP8* vp8Info = &(stream_codec_specific.codecSpecific.VP8); | 394   CodecSpecificInfoVP8* vp8Info = &(stream_codec_specific.codecSpecific.VP8); | 
| 391   vp8Info->simulcastIdx = stream_idx; | 395   vp8Info->simulcastIdx = stream_idx; | 
| 392 | 396 | 
| 393   if (streaminfos_[stream_idx].send_stream) { | 397   return encoded_complete_callback_->Encoded( | 
| 394     return encoded_complete_callback_->Encoded(encodedImage, | 398       encodedImage, &stream_codec_specific, fragmentation); | 
| 395                                                &stream_codec_specific, |  | 
| 396                                                fragmentation); |  | 
| 397   } else { |  | 
| 398     EncodedImage dummy_image; |  | 
| 399     // Required in case padding is applied to dropped frames. |  | 
| 400     dummy_image._timeStamp = encodedImage._timeStamp; |  | 
| 401     dummy_image.capture_time_ms_ = encodedImage.capture_time_ms_; |  | 
| 402     dummy_image._encodedWidth = encodedImage._encodedWidth; |  | 
| 403     dummy_image._encodedHeight = encodedImage._encodedHeight; |  | 
| 404     dummy_image._length = 0; |  | 
| 405     dummy_image._frameType = kSkipFrame; |  | 
| 406     vp8Info->keyIdx = kNoKeyIdx; |  | 
| 407     return encoded_complete_callback_->Encoded(dummy_image, |  | 
| 408                                                &stream_codec_specific, NULL); |  | 
| 409   } |  | 
| 410 } | 399 } | 
| 411 | 400 | 
| 412 uint32_t SimulcastEncoderAdapter::GetStreamBitrate( | 401 uint32_t SimulcastEncoderAdapter::GetStreamBitrate( | 
| 413     int stream_idx, | 402     int stream_idx, | 
| 414     size_t total_number_of_streams, | 403     size_t total_number_of_streams, | 
| 415     uint32_t new_bitrate_kbit, | 404     uint32_t new_bitrate_kbit, | 
| 416     bool* send_stream) const { | 405     bool* send_stream) const { | 
| 417   if (total_number_of_streams == 1) { | 406   if (total_number_of_streams == 1) { | 
| 418     *send_stream = true; | 407     *send_stream = true; | 
| 419     return new_bitrate_kbit; | 408     return new_bitrate_kbit; | 
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 502 | 491 | 
| 503 void SimulcastEncoderAdapter::OnDroppedFrame() { | 492 void SimulcastEncoderAdapter::OnDroppedFrame() { | 
| 504   streaminfos_[0].encoder->OnDroppedFrame(); | 493   streaminfos_[0].encoder->OnDroppedFrame(); | 
| 505 } | 494 } | 
| 506 | 495 | 
| 507 int SimulcastEncoderAdapter::GetTargetFramerate() { | 496 int SimulcastEncoderAdapter::GetTargetFramerate() { | 
| 508   return streaminfos_[0].encoder->GetTargetFramerate(); | 497   return streaminfos_[0].encoder->GetTargetFramerate(); | 
| 509 } | 498 } | 
| 510 | 499 | 
| 511 }  // namespace webrtc | 500 }  // namespace webrtc | 
| OLD | NEW | 
|---|