| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void SetTargetFramerate(int frame_rate); | 75 void SetTargetFramerate(int frame_rate); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 VideoProcessing* vp_; | 78 VideoProcessing* vp_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 ViEEncoder::ViEEncoder(uint32_t number_of_cores, | 81 ViEEncoder::ViEEncoder(uint32_t number_of_cores, |
| 82 const std::vector<uint32_t>& ssrcs, | 82 const std::vector<uint32_t>& ssrcs, |
| 83 ProcessThread* module_process_thread, | 83 ProcessThread* module_process_thread, |
| 84 SendStatisticsProxy* stats_proxy, | 84 SendStatisticsProxy* stats_proxy, |
| 85 I420FrameCallback* pre_encode_callback, | 85 rtc::VideoSinkInterface<VideoFrame>* pre_encode_callback, |
| 86 OveruseFrameDetector* overuse_detector, | 86 OveruseFrameDetector* overuse_detector, |
| 87 PacedSender* pacer, | 87 PacedSender* pacer, |
| 88 PayloadRouter* payload_router) | 88 PayloadRouter* payload_router) |
| 89 : number_of_cores_(number_of_cores), | 89 : number_of_cores_(number_of_cores), |
| 90 ssrcs_(ssrcs), | 90 ssrcs_(ssrcs), |
| 91 vp_(VideoProcessing::Create()), | 91 vp_(VideoProcessing::Create()), |
| 92 qm_callback_(new QMVideoSettingsCallback(vp_.get())), | 92 qm_callback_(new QMVideoSettingsCallback(vp_.get())), |
| 93 vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(), | 93 vcm_(VideoCodingModule::Create(Clock::GetRealTimeClock(), |
| 94 this, | 94 this, |
| 95 qm_callback_.get())), | 95 qm_callback_.get())), |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // TODO(wuchengli): support texture frames. | 336 // TODO(wuchengli): support texture frames. |
| 337 if (!video_frame.native_handle()) { | 337 if (!video_frame.native_handle()) { |
| 338 // Pass frame via preprocessor. | 338 // Pass frame via preprocessor. |
| 339 frame_to_send = vp_->PreprocessFrame(video_frame); | 339 frame_to_send = vp_->PreprocessFrame(video_frame); |
| 340 if (!frame_to_send) { | 340 if (!frame_to_send) { |
| 341 // Drop this frame, or there was an error processing it. | 341 // Drop this frame, or there was an error processing it. |
| 342 return; | 342 return; |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 // If we haven't resampled the frame and we have a FrameCallback, we need to | |
| 347 // make a deep copy of |video_frame|. | |
| 348 VideoFrame copied_frame; | |
| 349 if (pre_encode_callback_) { | 346 if (pre_encode_callback_) { |
| 350 copied_frame.CopyFrame(*frame_to_send); | 347 pre_encode_callback_->OnFrame(*frame_to_send); |
| 351 pre_encode_callback_->FrameCallback(&copied_frame); | |
| 352 frame_to_send = &copied_frame; | |
| 353 } | 348 } |
| 354 | 349 |
| 355 if (codec_type == webrtc::kVideoCodecVP8) { | 350 if (codec_type == webrtc::kVideoCodecVP8) { |
| 356 webrtc::CodecSpecificInfo codec_specific_info; | 351 webrtc::CodecSpecificInfo codec_specific_info; |
| 357 codec_specific_info.codecType = webrtc::kVideoCodecVP8; | 352 codec_specific_info.codecType = webrtc::kVideoCodecVP8; |
| 358 { | 353 { |
| 359 rtc::CritScope lock(&data_cs_); | 354 rtc::CritScope lock(&data_cs_); |
| 360 codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = | 355 codec_specific_info.codecSpecific.VP8.hasReceivedRPSI = |
| 361 has_received_rpsi_; | 356 has_received_rpsi_; |
| 362 codec_specific_info.codecSpecific.VP8.hasReceivedSLI = | 357 codec_specific_info.codecSpecific.VP8.hasReceivedSLI = |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 const uint32_t width, | 525 const uint32_t width, |
| 531 const uint32_t height) { | 526 const uint32_t height) { |
| 532 return vp_->SetTargetResolution(width, height, frame_rate); | 527 return vp_->SetTargetResolution(width, height, frame_rate); |
| 533 } | 528 } |
| 534 | 529 |
| 535 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { | 530 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { |
| 536 vp_->SetTargetFramerate(frame_rate); | 531 vp_->SetTargetFramerate(frame_rate); |
| 537 } | 532 } |
| 538 | 533 |
| 539 } // namespace webrtc | 534 } // namespace webrtc |
| OLD | NEW |