Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: webrtc/video/vie_encoder.cc

Issue 1900193004: Remove VCMPacketizationCallback (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed bug. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 SendStatisticsProxy* stats_proxy, 84 SendStatisticsProxy* stats_proxy,
85 rtc::VideoSinkInterface<VideoFrame>* 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 EncodedImageCallback* post_encode_callback) 89 EncodedImageCallback* post_encode_callback)
90 : number_of_cores_(number_of_cores), 90 : number_of_cores_(number_of_cores),
91 ssrcs_(ssrcs), 91 ssrcs_(ssrcs),
92 vp_(VideoProcessing::Create()), 92 vp_(VideoProcessing::Create()),
93 qm_callback_(new QMVideoSettingsCallback(vp_.get())), 93 qm_callback_(new QMVideoSettingsCallback(vp_.get())),
94 video_sender_(Clock::GetRealTimeClock(), this, this, qm_callback_.get()), 94 video_sender_(Clock::GetRealTimeClock(),
95 this,
96 this,
97 qm_callback_.get(),
98 this),
95 stats_proxy_(stats_proxy), 99 stats_proxy_(stats_proxy),
96 pre_encode_callback_(pre_encode_callback), 100 pre_encode_callback_(pre_encode_callback),
97 overuse_detector_(overuse_detector), 101 overuse_detector_(overuse_detector),
98 pacer_(pacer), 102 pacer_(pacer),
99 send_payload_router_(payload_router), 103 send_payload_router_(payload_router),
100 post_encode_callback_(post_encode_callback), 104 post_encode_callback_(post_encode_callback),
101 time_of_last_frame_activity_ms_(0), 105 time_of_last_frame_activity_ms_(0),
102 encoder_config_(), 106 encoder_config_(),
103 min_transmit_bitrate_bps_(0), 107 min_transmit_bitrate_bps_(0),
104 last_observed_bitrate_bps_(0), 108 last_observed_bitrate_bps_(0),
105 network_is_transmitting_(true), 109 network_is_transmitting_(true),
106 encoder_paused_(false), 110 encoder_paused_(false),
107 encoder_paused_and_dropped_frame_(false), 111 encoder_paused_and_dropped_frame_(false),
108 time_last_intra_request_ms_(ssrcs.size(), -1), 112 time_last_intra_request_ms_(ssrcs.size(), -1),
109 module_process_thread_(module_process_thread), 113 module_process_thread_(module_process_thread),
110 has_received_sli_(false), 114 has_received_sli_(false),
111 picture_id_sli_(0), 115 picture_id_sli_(0),
112 has_received_rpsi_(false), 116 has_received_rpsi_(false),
113 picture_id_rpsi_(0), 117 picture_id_rpsi_(0),
114 video_suspended_(false) { 118 video_suspended_(false) {
115 module_process_thread_->RegisterModule(&video_sender_); 119 module_process_thread_->RegisterModule(&video_sender_);
116 }
117
118 bool ViEEncoder::Init() {
119 vp_->EnableTemporalDecimation(true); 120 vp_->EnableTemporalDecimation(true);
120 121
121 // Enable/disable content analysis: off by default for now. 122 // Enable/disable content analysis: off by default for now.
122 vp_->EnableContentAnalysis(false); 123 vp_->EnableContentAnalysis(false);
123
124 // TODO(perkj): Remove |RegisterTransportCallback| as soon as we don't use
125 // VCMPacketizationCallback::OnEncoderImplementationName.
126 if (video_sender_.RegisterTransportCallback(this) != 0) {
127 return false;
128 }
129 if (video_sender_.RegisterSendStatisticsCallback(this) != 0) {
130 return false;
131 }
132 return true;
133 } 124 }
134 125
135 vcm::VideoSender* ViEEncoder::video_sender() { 126 vcm::VideoSender* ViEEncoder::video_sender() {
136 return &video_sender_; 127 return &video_sender_;
137 } 128 }
138 129
139 ViEEncoder::~ViEEncoder() { 130 ViEEncoder::~ViEEncoder() {
140 module_process_thread_->DeRegisterModule(&video_sender_); 131 module_process_thread_->DeRegisterModule(&video_sender_);
141 } 132 }
142 133
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 protection_mode = nack ? kProtectionNack : kProtectionNone; 373 protection_mode = nack ? kProtectionNack : kProtectionNone;
383 } 374 }
384 video_sender_.SetVideoProtection(protection_mode); 375 video_sender_.SetVideoProtection(protection_mode);
385 } 376 }
386 377
387 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { 378 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) {
388 if (stats_proxy_) 379 if (stats_proxy_)
389 stats_proxy_->OnSetRates(bitrate_bps, framerate); 380 stats_proxy_->OnSetRates(bitrate_bps, framerate);
390 } 381 }
391 382
392 void ViEEncoder::OnEncoderImplementationName(const char* implementation_name) {
393 if (stats_proxy_)
394 stats_proxy_->OnEncoderImplementationName(implementation_name);
395 }
396
397 int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image, 383 int32_t ViEEncoder::Encoded(const EncodedImage& encoded_image,
398 const CodecSpecificInfo* codec_specific_info, 384 const CodecSpecificInfo* codec_specific_info,
399 const RTPFragmentationHeader* fragmentation) { 385 const RTPFragmentationHeader* fragmentation) {
400 RTC_DCHECK(send_payload_router_); 386 RTC_DCHECK(send_payload_router_);
401 387
402 { 388 {
403 rtc::CritScope lock(&data_cs_); 389 rtc::CritScope lock(&data_cs_);
404 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); 390 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp();
405 } 391 }
406 392
(...skipping 30 matching lines...) Expand all
437 if (file_writer) { 423 if (file_writer) {
438 bool ok = file_writer->WriteFrame(encoded_image); 424 bool ok = file_writer->WriteFrame(encoded_image);
439 RTC_DCHECK(ok); 425 RTC_DCHECK(ok);
440 } 426 }
441 } 427 }
442 428
443 return success; 429 return success;
444 } 430 }
445 431
446 int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate, 432 int32_t ViEEncoder::SendStatistics(const uint32_t bit_rate,
447 const uint32_t frame_rate) { 433 const uint32_t frame_rate,
434 std::string&& encoder_name) {
448 if (stats_proxy_) 435 if (stats_proxy_)
449 stats_proxy_->OnOutgoingRate(frame_rate, bit_rate); 436 stats_proxy_->OnEncoderStatsUpdate(frame_rate, bit_rate,
pbos-webrtc 2016/05/02 00:16:06 {}s if this stays multiline
perkj_webrtc 2016/05/02 12:02:12 Done.
437 std::move(encoder_name));
450 return 0; 438 return 0;
451 } 439 }
452 440
453 void ViEEncoder::OnReceivedSLI(uint32_t /*ssrc*/, 441 void ViEEncoder::OnReceivedSLI(uint32_t /*ssrc*/,
454 uint8_t picture_id) { 442 uint8_t picture_id) {
455 rtc::CritScope lock(&data_cs_); 443 rtc::CritScope lock(&data_cs_);
456 picture_id_sli_ = picture_id; 444 picture_id_sli_ = picture_id;
457 has_received_sli_ = true; 445 has_received_sli_ = true;
458 } 446 }
459 447
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 const uint32_t width, 521 const uint32_t width,
534 const uint32_t height) { 522 const uint32_t height) {
535 return vp_->SetTargetResolution(width, height, frame_rate); 523 return vp_->SetTargetResolution(width, height, frame_rate);
536 } 524 }
537 525
538 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { 526 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) {
539 vp_->SetTargetFramerate(frame_rate); 527 vp_->SetTargetFramerate(frame_rate);
540 } 528 }
541 529
542 } // namespace webrtc 530 } // namespace webrtc
OLDNEW
« webrtc/video/send_statistics_proxy_unittest.cc ('K') | « webrtc/video/vie_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698