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

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

Issue 1335923002: Add RTC_ prefix to (D)CHECKs and related macros. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 5 years, 3 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
« no previous file with comments | « webrtc/video_engine/vie_channel_group.cc ('k') | webrtc/video_frame.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 if (vcm_->RegisterSendStatisticsCallback(this) != 0) { 154 if (vcm_->RegisterSendStatisticsCallback(this) != 0) {
155 return false; 155 return false;
156 } 156 }
157 return true; 157 return true;
158 } 158 }
159 159
160 void ViEEncoder::StartThreadsAndSetSharedMembers( 160 void ViEEncoder::StartThreadsAndSetSharedMembers(
161 rtc::scoped_refptr<PayloadRouter> send_payload_router, 161 rtc::scoped_refptr<PayloadRouter> send_payload_router,
162 VCMProtectionCallback* vcm_protection_callback) { 162 VCMProtectionCallback* vcm_protection_callback) {
163 DCHECK(send_payload_router_ == NULL); 163 RTC_DCHECK(send_payload_router_ == NULL);
164 164
165 send_payload_router_ = send_payload_router; 165 send_payload_router_ = send_payload_router;
166 vcm_->RegisterProtectionCallback(vcm_protection_callback); 166 vcm_->RegisterProtectionCallback(vcm_protection_callback);
167 module_process_thread_.RegisterModule(vcm_.get()); 167 module_process_thread_.RegisterModule(vcm_.get());
168 } 168 }
169 169
170 void ViEEncoder::StopThreadsAndRemoveSharedMembers() { 170 void ViEEncoder::StopThreadsAndRemoveSharedMembers() {
171 if (bitrate_allocator_) 171 if (bitrate_allocator_)
172 bitrate_allocator_->RemoveBitrateObserver(bitrate_observer_.get()); 172 bitrate_allocator_->RemoveBitrateObserver(bitrate_observer_.get());
173 module_process_thread_.DeRegisterModule(vcm_.get()); 173 module_process_thread_.DeRegisterModule(vcm_.get());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { 249 int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) {
250 if (vcm_->RegisterExternalEncoder(NULL, pl_type) != VCM_OK) { 250 if (vcm_->RegisterExternalEncoder(NULL, pl_type) != VCM_OK) {
251 return -1; 251 return -1;
252 } 252 }
253 return 0; 253 return 0;
254 } 254 }
255 255
256 int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) { 256 int32_t ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec) {
257 DCHECK(send_payload_router_ != NULL); 257 RTC_DCHECK(send_payload_router_ != NULL);
258 // Setting target width and height for VPM. 258 // Setting target width and height for VPM.
259 if (vpm_->SetTargetResolution(video_codec.width, video_codec.height, 259 if (vpm_->SetTargetResolution(video_codec.width, video_codec.height,
260 video_codec.maxFramerate) != VPM_OK) { 260 video_codec.maxFramerate) != VPM_OK) {
261 return -1; 261 return -1;
262 } 262 }
263 263
264 { 264 {
265 CriticalSectionScoped cs(data_cs_.get()); 265 CriticalSectionScoped cs(data_cs_.get());
266 simulcast_enabled_ = video_codec.numberOfSimulcastStreams > 1; 266 simulcast_enabled_ = video_codec.numberOfSimulcastStreams > 1;
267 } 267 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 407
408 void ViEEncoder::TraceFrameDropEnd() { 408 void ViEEncoder::TraceFrameDropEnd() {
409 // End trace event on first frame after encoder resumes, if frame was dropped. 409 // End trace event on first frame after encoder resumes, if frame was dropped.
410 if (encoder_paused_and_dropped_frame_) { 410 if (encoder_paused_and_dropped_frame_) {
411 TRACE_EVENT_ASYNC_END0("webrtc", "EncoderPaused", this); 411 TRACE_EVENT_ASYNC_END0("webrtc", "EncoderPaused", this);
412 } 412 }
413 encoder_paused_and_dropped_frame_ = false; 413 encoder_paused_and_dropped_frame_ = false;
414 } 414 }
415 415
416 void ViEEncoder::DeliverFrame(VideoFrame video_frame) { 416 void ViEEncoder::DeliverFrame(VideoFrame video_frame) {
417 DCHECK(send_payload_router_ != NULL); 417 RTC_DCHECK(send_payload_router_ != NULL);
418 if (!send_payload_router_->active()) { 418 if (!send_payload_router_->active()) {
419 // We've paused or we have no channels attached, don't waste resources on 419 // We've paused or we have no channels attached, don't waste resources on
420 // encoding. 420 // encoding.
421 return; 421 return;
422 } 422 }
423 { 423 {
424 CriticalSectionScoped cs(data_cs_.get()); 424 CriticalSectionScoped cs(data_cs_.get());
425 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); 425 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp();
426 if (EncoderPaused()) { 426 if (EncoderPaused()) {
427 TraceFrameDropStart(); 427 TraceFrameDropStart();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 return last_observed_bitrate_bps_; 512 return last_observed_bitrate_bps_;
513 } 513 }
514 514
515 int ViEEncoder::CodecTargetBitrate(uint32_t* bitrate) const { 515 int ViEEncoder::CodecTargetBitrate(uint32_t* bitrate) const {
516 if (vcm_->Bitrate(bitrate) != 0) 516 if (vcm_->Bitrate(bitrate) != 0)
517 return -1; 517 return -1;
518 return 0; 518 return 0;
519 } 519 }
520 520
521 int32_t ViEEncoder::UpdateProtectionMethod(bool nack, bool fec) { 521 int32_t ViEEncoder::UpdateProtectionMethod(bool nack, bool fec) {
522 DCHECK(send_payload_router_ != NULL); 522 RTC_DCHECK(send_payload_router_ != NULL);
523 523
524 if (fec_enabled_ == fec && nack_enabled_ == nack) { 524 if (fec_enabled_ == fec && nack_enabled_ == nack) {
525 // No change needed, we're already in correct state. 525 // No change needed, we're already in correct state.
526 return 0; 526 return 0;
527 } 527 }
528 fec_enabled_ = fec; 528 fec_enabled_ = fec;
529 nack_enabled_ = nack; 529 nack_enabled_ = nack;
530 530
531 // Set Video Protection for VCM. 531 // Set Video Protection for VCM.
532 VCMVideoProtection protection_mode; 532 VCMVideoProtection protection_mode;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 CriticalSectionScoped cs(callback_cs_.get()); 580 CriticalSectionScoped cs(callback_cs_.get());
581 if (send_statistics_proxy_ != nullptr) 581 if (send_statistics_proxy_ != nullptr)
582 send_statistics_proxy_->OnSetRates(bitrate_bps, framerate); 582 send_statistics_proxy_->OnSetRates(bitrate_bps, framerate);
583 } 583 }
584 584
585 int32_t ViEEncoder::SendData( 585 int32_t ViEEncoder::SendData(
586 const uint8_t payload_type, 586 const uint8_t payload_type,
587 const EncodedImage& encoded_image, 587 const EncodedImage& encoded_image,
588 const webrtc::RTPFragmentationHeader& fragmentation_header, 588 const webrtc::RTPFragmentationHeader& fragmentation_header,
589 const RTPVideoHeader* rtp_video_hdr) { 589 const RTPVideoHeader* rtp_video_hdr) {
590 DCHECK(send_payload_router_ != NULL); 590 RTC_DCHECK(send_payload_router_ != NULL);
591 591
592 { 592 {
593 CriticalSectionScoped cs(data_cs_.get()); 593 CriticalSectionScoped cs(data_cs_.get());
594 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); 594 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp();
595 } 595 }
596 596
597 { 597 {
598 CriticalSectionScoped cs(callback_cs_.get()); 598 CriticalSectionScoped cs(callback_cs_.get());
599 if (send_statistics_proxy_ != NULL) 599 if (send_statistics_proxy_ != NULL)
600 send_statistics_proxy_->OnSendEncodedImage(encoded_image, rtp_video_hdr); 600 send_statistics_proxy_->OnSendEncodedImage(encoded_image, rtp_video_hdr);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 min_transmit_bitrate_kbps_ = min_transmit_bitrate_kbps; 716 min_transmit_bitrate_kbps_ = min_transmit_bitrate_kbps;
717 } 717 }
718 718
719 // Called from ViEBitrateObserver. 719 // Called from ViEBitrateObserver.
720 void ViEEncoder::OnNetworkChanged(uint32_t bitrate_bps, 720 void ViEEncoder::OnNetworkChanged(uint32_t bitrate_bps,
721 uint8_t fraction_lost, 721 uint8_t fraction_lost,
722 int64_t round_trip_time_ms) { 722 int64_t round_trip_time_ms) {
723 LOG(LS_VERBOSE) << "OnNetworkChanged, bitrate" << bitrate_bps 723 LOG(LS_VERBOSE) << "OnNetworkChanged, bitrate" << bitrate_bps
724 << " packet loss " << static_cast<int>(fraction_lost) 724 << " packet loss " << static_cast<int>(fraction_lost)
725 << " rtt " << round_trip_time_ms; 725 << " rtt " << round_trip_time_ms;
726 DCHECK(send_payload_router_ != NULL); 726 RTC_DCHECK(send_payload_router_ != NULL);
727 vcm_->SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms); 727 vcm_->SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms);
728 bool video_is_suspended = vcm_->VideoSuspended(); 728 bool video_is_suspended = vcm_->VideoSuspended();
729 729
730 VideoCodec send_codec; 730 VideoCodec send_codec;
731 if (vcm_->SendCodec(&send_codec) != 0) { 731 if (vcm_->SendCodec(&send_codec) != 0) {
732 return; 732 return;
733 } 733 }
734 SimulcastStream* stream_configs = send_codec.simulcastStream; 734 SimulcastStream* stream_configs = send_codec.simulcastStream;
735 // Allocate the bandwidth between the streams. 735 // Allocate the bandwidth between the streams.
736 std::vector<uint32_t> stream_bitrates = AllocateStreamBitrates( 736 std::vector<uint32_t> stream_bitrates = AllocateStreamBitrates(
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 const uint32_t width, 787 const uint32_t width,
788 const uint32_t height) { 788 const uint32_t height) {
789 return vpm_->SetTargetResolution(width, height, frame_rate); 789 return vpm_->SetTargetResolution(width, height, frame_rate);
790 } 790 }
791 791
792 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { 792 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) {
793 vpm_->SetTargetFramerate(frame_rate); 793 vpm_->SetTargetFramerate(frame_rate);
794 } 794 }
795 795
796 } // namespace webrtc 796 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video_engine/vie_channel_group.cc ('k') | webrtc/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698