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

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

Issue 1855433002: Replace NULL with nullptr in webrtc/video. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: replace x == nullptr with !x Created 4 years, 8 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/vie_channel.cc ('k') | webrtc/video/vie_receiver.cc » ('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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 uint8_t pl_type, 159 uint8_t pl_type,
160 bool internal_source) { 160 bool internal_source) {
161 if (vcm_->RegisterExternalEncoder(encoder, pl_type, internal_source) != 161 if (vcm_->RegisterExternalEncoder(encoder, pl_type, internal_source) !=
162 VCM_OK) { 162 VCM_OK) {
163 return -1; 163 return -1;
164 } 164 }
165 return 0; 165 return 0;
166 } 166 }
167 167
168 int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) { 168 int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) {
169 if (vcm_->RegisterExternalEncoder(NULL, pl_type) != VCM_OK) { 169 if (vcm_->RegisterExternalEncoder(nullptr, pl_type) != VCM_OK) {
170 return -1; 170 return -1;
171 } 171 }
172 return 0; 172 return 0;
173 } 173 }
174 void ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec, 174 void ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec,
175 int min_transmit_bitrate_bps) { 175 int min_transmit_bitrate_bps) {
176 RTC_DCHECK(send_payload_router_ != NULL); 176 RTC_DCHECK(send_payload_router_);
177 // Setting target width and height for VPM. 177 // Setting target width and height for VPM.
178 RTC_CHECK_EQ(VPM_OK, 178 RTC_CHECK_EQ(VPM_OK,
179 vp_->SetTargetResolution(video_codec.width, video_codec.height, 179 vp_->SetTargetResolution(video_codec.width, video_codec.height,
180 video_codec.maxFramerate)); 180 video_codec.maxFramerate));
181 181
182 // Cache codec before calling AddBitrateObserver (which calls OnBitrateUpdated 182 // Cache codec before calling AddBitrateObserver (which calls OnBitrateUpdated
183 // that makes use of the number of simulcast streams configured). 183 // that makes use of the number of simulcast streams configured).
184 { 184 {
185 rtc::CritScope lock(&data_cs_); 185 rtc::CritScope lock(&data_cs_);
186 encoder_config_ = video_codec; 186 encoder_config_ = video_codec;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 return; 327 return;
328 } 328 }
329 TraceFrameDropEnd(); 329 TraceFrameDropEnd();
330 codec_type = encoder_config_.codecType; 330 codec_type = encoder_config_.codecType;
331 } 331 }
332 332
333 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", video_frame.render_time_ms(), 333 TRACE_EVENT_ASYNC_STEP0("webrtc", "Video", video_frame.render_time_ms(),
334 "Encode"); 334 "Encode");
335 const VideoFrame* frame_to_send = &video_frame; 335 const VideoFrame* frame_to_send = &video_frame;
336 // TODO(wuchengli): support texture frames. 336 // TODO(wuchengli): support texture frames.
337 if (video_frame.native_handle() == NULL) { 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 346 // If we haven't resampled the frame and we have a FrameCallback, we need to
347 // make a deep copy of |video_frame|. 347 // make a deep copy of |video_frame|.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) { 406 void ViEEncoder::OnSetRates(uint32_t bitrate_bps, int framerate) {
407 if (stats_proxy_) 407 if (stats_proxy_)
408 stats_proxy_->OnSetRates(bitrate_bps, framerate); 408 stats_proxy_->OnSetRates(bitrate_bps, framerate);
409 } 409 }
410 410
411 int32_t ViEEncoder::SendData(const uint8_t payload_type, 411 int32_t ViEEncoder::SendData(const uint8_t payload_type,
412 const EncodedImage& encoded_image, 412 const EncodedImage& encoded_image,
413 const RTPFragmentationHeader* fragmentation_header, 413 const RTPFragmentationHeader* fragmentation_header,
414 const RTPVideoHeader* rtp_video_hdr) { 414 const RTPVideoHeader* rtp_video_hdr) {
415 RTC_DCHECK(send_payload_router_ != NULL); 415 RTC_DCHECK(send_payload_router_);
416 416
417 { 417 {
418 rtc::CritScope lock(&data_cs_); 418 rtc::CritScope lock(&data_cs_);
419 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp(); 419 time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp();
420 } 420 }
421 421
422 if (stats_proxy_ != NULL) 422 if (stats_proxy_)
423 stats_proxy_->OnSendEncodedImage(encoded_image, rtp_video_hdr); 423 stats_proxy_->OnSendEncodedImage(encoded_image, rtp_video_hdr);
424 424
425 bool success = send_payload_router_->RoutePayload( 425 bool success = send_payload_router_->RoutePayload(
426 encoded_image._frameType, payload_type, encoded_image._timeStamp, 426 encoded_image._frameType, payload_type, encoded_image._timeStamp,
427 encoded_image.capture_time_ms_, encoded_image._buffer, 427 encoded_image.capture_time_ms_, encoded_image._buffer,
428 encoded_image._length, fragmentation_header, rtp_video_hdr); 428 encoded_image._length, fragmentation_header, rtp_video_hdr);
429 overuse_detector_->FrameSent(encoded_image._timeStamp); 429 overuse_detector_->FrameSent(encoded_image._timeStamp);
430 return success ? 0 : -1; 430 return success ? 0 : -1;
431 } 431 }
432 432
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 478 }
479 RTC_NOTREACHED() << "Should not receive keyframe requests on unknown SSRCs."; 479 RTC_NOTREACHED() << "Should not receive keyframe requests on unknown SSRCs.";
480 } 480 }
481 481
482 void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps, 482 void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
483 uint8_t fraction_lost, 483 uint8_t fraction_lost,
484 int64_t round_trip_time_ms) { 484 int64_t round_trip_time_ms) {
485 LOG(LS_VERBOSE) << "OnBitrateUpdated, bitrate" << bitrate_bps 485 LOG(LS_VERBOSE) << "OnBitrateUpdated, bitrate" << bitrate_bps
486 << " packet loss " << static_cast<int>(fraction_lost) 486 << " packet loss " << static_cast<int>(fraction_lost)
487 << " rtt " << round_trip_time_ms; 487 << " rtt " << round_trip_time_ms;
488 RTC_DCHECK(send_payload_router_ != NULL); 488 RTC_DCHECK(send_payload_router_);
489 vcm_->SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms); 489 vcm_->SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms);
490 bool video_is_suspended = vcm_->VideoSuspended(); 490 bool video_is_suspended = vcm_->VideoSuspended();
491 bool video_suspension_changed; 491 bool video_suspension_changed;
492 VideoCodec send_codec; 492 VideoCodec send_codec;
493 { 493 {
494 rtc::CritScope lock(&data_cs_); 494 rtc::CritScope lock(&data_cs_);
495 last_observed_bitrate_bps_ = bitrate_bps; 495 last_observed_bitrate_bps_ = bitrate_bps;
496 video_suspension_changed = video_suspended_ != video_is_suspended; 496 video_suspension_changed = video_suspended_ != video_is_suspended;
497 video_suspended_ = video_is_suspended; 497 video_suspended_ = video_is_suspended;
498 send_codec = encoder_config_; 498 send_codec = encoder_config_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 const uint32_t width, 530 const uint32_t width,
531 const uint32_t height) { 531 const uint32_t height) {
532 return vp_->SetTargetResolution(width, height, frame_rate); 532 return vp_->SetTargetResolution(width, height, frame_rate);
533 } 533 }
534 534
535 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { 535 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) {
536 vp_->SetTargetFramerate(frame_rate); 536 vp_->SetTargetFramerate(frame_rate);
537 } 537 }
538 538
539 } // namespace webrtc 539 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/vie_channel.cc ('k') | webrtc/video/vie_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698