Replace NULL with nullptr in webrtc/video.
BUG= R=danilchap@webrtc.org Review URL: https://codereview.webrtc.org/1855433002 . Cr-Commit-Position: refs/heads/master@{#12218}
This commit is contained in:
parent
d620f820c9
commit
74f6e9ea23
@ -26,7 +26,7 @@ int32_t EncodedFrameCallbackAdapter::Encoded(
|
||||
const EncodedImage& encodedImage,
|
||||
const CodecSpecificInfo* codecSpecificInfo,
|
||||
const RTPFragmentationHeader* fragmentation) {
|
||||
RTC_DCHECK(observer_ != nullptr);
|
||||
RTC_DCHECK(observer_);
|
||||
const EncodedFrame frame(encodedImage._buffer, encodedImage._length,
|
||||
encodedImage._frameType);
|
||||
observer_->EncodedFrameCallback(frame);
|
||||
|
||||
@ -1528,7 +1528,7 @@ TEST_F(EndToEndTest, AssignsTransportSequenceNumbers) {
|
||||
|
||||
protected:
|
||||
void Wait() override {
|
||||
RTC_DCHECK(observer_ != nullptr);
|
||||
RTC_DCHECK(observer_);
|
||||
EXPECT_TRUE(observer_->Wait());
|
||||
}
|
||||
|
||||
@ -2670,7 +2670,7 @@ TEST_F(EndToEndTest, GetStats) {
|
||||
}
|
||||
|
||||
bool CheckSendStats() {
|
||||
RTC_DCHECK(send_stream_ != nullptr);
|
||||
RTC_DCHECK(send_stream_);
|
||||
VideoSendStream::Stats stats = send_stream_->GetStats();
|
||||
|
||||
send_stats_filled_["NumStreams"] |=
|
||||
|
||||
@ -193,7 +193,7 @@ OveruseFrameDetector::OveruseFrameDetector(
|
||||
in_quick_rampup_(false),
|
||||
current_rampup_delay_ms_(kStandardRampUpDelayMs),
|
||||
usage_(new SendProcessingUsage(options)) {
|
||||
RTC_DCHECK(metrics_observer != nullptr);
|
||||
RTC_DCHECK(metrics_observer);
|
||||
processing_thread_.DetachFromThread();
|
||||
}
|
||||
|
||||
@ -341,13 +341,13 @@ void OveruseFrameDetector::Process() {
|
||||
checks_above_threshold_ = 0;
|
||||
++num_overuse_detections_;
|
||||
|
||||
if (observer_ != NULL)
|
||||
if (observer_)
|
||||
observer_->OveruseDetected();
|
||||
} else if (IsUnderusing(current_metrics, now)) {
|
||||
last_rampup_time_ms_ = now;
|
||||
in_quick_rampup_ = true;
|
||||
|
||||
if (observer_ != NULL)
|
||||
if (observer_)
|
||||
observer_->NormalUsage();
|
||||
}
|
||||
|
||||
|
||||
@ -42,39 +42,39 @@ TEST_F(PayloadRouterTest, SendOnOneModule) {
|
||||
FrameType frame_type = kVideoFrameKey;
|
||||
int8_t payload_type = 96;
|
||||
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1, NULL,
|
||||
NULL))
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1,
|
||||
nullptr, nullptr))
|
||||
.Times(0);
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(frame_type, payload_type, 0, 0,
|
||||
&payload, 1, NULL, NULL));
|
||||
&payload, 1, nullptr, nullptr));
|
||||
|
||||
payload_router_->set_active(true);
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1, NULL,
|
||||
NULL))
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1,
|
||||
nullptr, nullptr))
|
||||
.Times(1);
|
||||
EXPECT_TRUE(payload_router_->RoutePayload(frame_type, payload_type, 0, 0,
|
||||
&payload, 1, NULL, NULL));
|
||||
&payload, 1, nullptr, nullptr));
|
||||
|
||||
payload_router_->set_active(false);
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1, NULL,
|
||||
NULL))
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1,
|
||||
nullptr, nullptr))
|
||||
.Times(0);
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(frame_type, payload_type, 0, 0,
|
||||
&payload, 1, NULL, NULL));
|
||||
&payload, 1, nullptr, nullptr));
|
||||
|
||||
payload_router_->set_active(true);
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1, NULL,
|
||||
NULL))
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1,
|
||||
nullptr, nullptr))
|
||||
.Times(1);
|
||||
EXPECT_TRUE(payload_router_->RoutePayload(frame_type, payload_type, 0, 0,
|
||||
&payload, 1, NULL, NULL));
|
||||
&payload, 1, nullptr, nullptr));
|
||||
|
||||
payload_router_->SetSendingRtpModules(0);
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1, NULL,
|
||||
NULL))
|
||||
EXPECT_CALL(rtp, SendOutgoingData(frame_type, payload_type, 0, 0, _, 1,
|
||||
nullptr, nullptr))
|
||||
.Times(0);
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(frame_type, payload_type, 0, 0,
|
||||
&payload, 1, NULL, NULL));
|
||||
&payload, 1, nullptr, nullptr));
|
||||
}
|
||||
|
||||
TEST_F(PayloadRouterTest, SendSimulcast) {
|
||||
@ -95,12 +95,12 @@ TEST_F(PayloadRouterTest, SendSimulcast) {
|
||||
|
||||
payload_router_->set_active(true);
|
||||
EXPECT_CALL(rtp_1, SendOutgoingData(frame_type_1, payload_type_1, 0, 0, _, 1,
|
||||
NULL, &rtp_hdr_1))
|
||||
nullptr, &rtp_hdr_1))
|
||||
.Times(1);
|
||||
EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _))
|
||||
.Times(0);
|
||||
EXPECT_TRUE(payload_router_->RoutePayload(frame_type_1, payload_type_1, 0, 0,
|
||||
&payload_1, 1, NULL, &rtp_hdr_1));
|
||||
EXPECT_TRUE(payload_router_->RoutePayload(
|
||||
frame_type_1, payload_type_1, 0, 0, &payload_1, 1, nullptr, &rtp_hdr_1));
|
||||
|
||||
uint8_t payload_2 = 'b';
|
||||
FrameType frame_type_2 = kVideoFrameDelta;
|
||||
@ -108,12 +108,12 @@ TEST_F(PayloadRouterTest, SendSimulcast) {
|
||||
RTPVideoHeader rtp_hdr_2;
|
||||
rtp_hdr_2.simulcastIdx = 1;
|
||||
EXPECT_CALL(rtp_2, SendOutgoingData(frame_type_2, payload_type_2, 0, 0, _, 1,
|
||||
NULL, &rtp_hdr_2))
|
||||
nullptr, &rtp_hdr_2))
|
||||
.Times(1);
|
||||
EXPECT_CALL(rtp_1, SendOutgoingData(_, _, _, _, _, _, _, _))
|
||||
.Times(0);
|
||||
EXPECT_TRUE(payload_router_->RoutePayload(frame_type_2, payload_type_2, 0, 0,
|
||||
&payload_2, 1, NULL, &rtp_hdr_2));
|
||||
EXPECT_TRUE(payload_router_->RoutePayload(
|
||||
frame_type_2, payload_type_2, 0, 0, &payload_2, 1, nullptr, &rtp_hdr_2));
|
||||
|
||||
// Inactive.
|
||||
payload_router_->set_active(false);
|
||||
@ -121,10 +121,10 @@ TEST_F(PayloadRouterTest, SendSimulcast) {
|
||||
.Times(0);
|
||||
EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _))
|
||||
.Times(0);
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(frame_type_1, payload_type_1, 0, 0,
|
||||
&payload_1, 1, NULL, &rtp_hdr_1));
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(frame_type_2, payload_type_2, 0, 0,
|
||||
&payload_2, 1, NULL, &rtp_hdr_2));
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(
|
||||
frame_type_1, payload_type_1, 0, 0, &payload_1, 1, nullptr, &rtp_hdr_1));
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(
|
||||
frame_type_2, payload_type_2, 0, 0, &payload_2, 1, nullptr, &rtp_hdr_2));
|
||||
|
||||
// Invalid simulcast index.
|
||||
payload_router_->SetSendingRtpModules(1);
|
||||
@ -134,8 +134,8 @@ TEST_F(PayloadRouterTest, SendSimulcast) {
|
||||
EXPECT_CALL(rtp_2, SendOutgoingData(_, _, _, _, _, _, _, _))
|
||||
.Times(0);
|
||||
rtp_hdr_1.simulcastIdx = 1;
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(frame_type_1, payload_type_1, 0, 0,
|
||||
&payload_1, 1, NULL, &rtp_hdr_1));
|
||||
EXPECT_FALSE(payload_router_->RoutePayload(
|
||||
frame_type_1, payload_type_1, 0, 0, &payload_1, 1, nullptr, &rtp_hdr_1));
|
||||
}
|
||||
|
||||
TEST_F(PayloadRouterTest, MaxPayloadLength) {
|
||||
|
||||
@ -272,7 +272,7 @@ void ReceiveStatisticsProxy::OnDiscardedPacketsUpdated(int discarded_packets) {
|
||||
void ReceiveStatisticsProxy::OnPreDecode(
|
||||
const EncodedImage& encoded_image,
|
||||
const CodecSpecificInfo* codec_specific_info) {
|
||||
if (codec_specific_info == nullptr || encoded_image.qp_ == -1) {
|
||||
if (!codec_specific_info || encoded_image.qp_ == -1) {
|
||||
return;
|
||||
}
|
||||
if (codec_specific_info->codecType == kVideoCodecVP8) {
|
||||
|
||||
@ -148,19 +148,19 @@ class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> {
|
||||
last_height_(0) {}
|
||||
|
||||
~FileRenderPassthrough() {
|
||||
if (file_ != nullptr)
|
||||
if (file_)
|
||||
fclose(file_);
|
||||
}
|
||||
|
||||
private:
|
||||
void OnFrame(const VideoFrame& video_frame) override {
|
||||
if (renderer_ != nullptr)
|
||||
if (renderer_)
|
||||
renderer_->OnFrame(video_frame);
|
||||
if (basename_.empty())
|
||||
return;
|
||||
if (last_width_ != video_frame.width() ||
|
||||
last_height_ != video_frame.height()) {
|
||||
if (file_ != nullptr)
|
||||
if (file_)
|
||||
fclose(file_);
|
||||
std::stringstream filename;
|
||||
filename << basename_;
|
||||
@ -169,7 +169,7 @@ class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> {
|
||||
filename << '_' << video_frame.width() << 'x' << video_frame.height()
|
||||
<< ".yuv";
|
||||
file_ = fopen(filename.str().c_str(), "wb");
|
||||
if (file_ == nullptr) {
|
||||
if (!file_) {
|
||||
fprintf(stderr,
|
||||
"Couldn't open file for writing: %s\n",
|
||||
filename.str().c_str());
|
||||
@ -177,7 +177,7 @@ class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> {
|
||||
}
|
||||
last_width_ = video_frame.width();
|
||||
last_height_ = video_frame.height();
|
||||
if (file_ == nullptr)
|
||||
if (!file_)
|
||||
return;
|
||||
PrintVideoFrame(video_frame, file_);
|
||||
}
|
||||
@ -194,7 +194,7 @@ class DecoderBitstreamFileWriter : public EncodedFrameObserver {
|
||||
public:
|
||||
explicit DecoderBitstreamFileWriter(const char* filename)
|
||||
: file_(fopen(filename, "wb")) {
|
||||
RTC_DCHECK(file_ != nullptr);
|
||||
RTC_DCHECK(file_);
|
||||
}
|
||||
~DecoderBitstreamFileWriter() { fclose(file_); }
|
||||
|
||||
@ -255,17 +255,17 @@ void RtpReplay() {
|
||||
|
||||
std::unique_ptr<test::RtpFileReader> rtp_reader(test::RtpFileReader::Create(
|
||||
test::RtpFileReader::kRtpDump, flags::InputFile()));
|
||||
if (rtp_reader.get() == nullptr) {
|
||||
if (!rtp_reader) {
|
||||
rtp_reader.reset(test::RtpFileReader::Create(test::RtpFileReader::kPcap,
|
||||
flags::InputFile()));
|
||||
if (rtp_reader.get() == nullptr) {
|
||||
if (!rtp_reader) {
|
||||
fprintf(stderr,
|
||||
"Couldn't open input file as either a rtpdump or .pcap. Note "
|
||||
"that .pcapng is not supported.\nTrying to interpret the file as "
|
||||
"length/packet interleaved.\n");
|
||||
rtp_reader.reset(test::RtpFileReader::Create(
|
||||
test::RtpFileReader::kLengthPacketInterleaved, flags::InputFile()));
|
||||
if (rtp_reader.get() == nullptr) {
|
||||
if (!rtp_reader) {
|
||||
fprintf(stderr,
|
||||
"Unable to open input file with any supported format\n");
|
||||
return;
|
||||
|
||||
@ -390,7 +390,7 @@ VideoSendStream::StreamStats* SendStatisticsProxy::GetStatsEntry(
|
||||
void SendStatisticsProxy::OnInactiveSsrc(uint32_t ssrc) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
stats->total_bitrate_bps = 0;
|
||||
@ -407,8 +407,7 @@ void SendStatisticsProxy::OnSetRates(uint32_t bitrate_bps, int framerate) {
|
||||
void SendStatisticsProxy::OnSendEncodedImage(
|
||||
const EncodedImage& encoded_image,
|
||||
const RTPVideoHeader* rtp_video_header) {
|
||||
size_t simulcast_idx =
|
||||
rtp_video_header != nullptr ? rtp_video_header->simulcastIdx : 0;
|
||||
size_t simulcast_idx = rtp_video_header ? rtp_video_header->simulcastIdx : 0;
|
||||
if (simulcast_idx >= config_.rtp.ssrcs.size()) {
|
||||
LOG(LS_ERROR) << "Encoded image outside simulcast range (" << simulcast_idx
|
||||
<< " >= " << config_.rtp.ssrcs.size() << ").";
|
||||
@ -418,7 +417,7 @@ void SendStatisticsProxy::OnSendEncodedImage(
|
||||
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
stats->width = encoded_image._encodedWidth;
|
||||
@ -450,7 +449,7 @@ void SendStatisticsProxy::OnSendEncodedImage(
|
||||
}
|
||||
}
|
||||
|
||||
if (encoded_image.qp_ != -1 && rtp_video_header != nullptr &&
|
||||
if (encoded_image.qp_ != -1 && rtp_video_header &&
|
||||
rtp_video_header->codec == kRtpVideoVp8) {
|
||||
int spatial_idx =
|
||||
(config_.rtp.ssrcs.size() == 1) ? -1 : static_cast<int>(simulcast_idx);
|
||||
@ -491,7 +490,7 @@ void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(
|
||||
const RtcpPacketTypeCounter& packet_counter) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
stats->rtcp_packet_type_counts = packet_counter;
|
||||
@ -503,7 +502,7 @@ void SendStatisticsProxy::StatisticsUpdated(const RtcpStatistics& statistics,
|
||||
uint32_t ssrc) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
stats->rtcp_stats = statistics;
|
||||
@ -517,8 +516,8 @@ void SendStatisticsProxy::DataCountersUpdated(
|
||||
uint32_t ssrc) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
RTC_DCHECK(stats != nullptr)
|
||||
<< "DataCountersUpdated reported for unknown ssrc: " << ssrc;
|
||||
RTC_DCHECK(stats) << "DataCountersUpdated reported for unknown ssrc: "
|
||||
<< ssrc;
|
||||
|
||||
stats->rtp_stats = counters;
|
||||
if (uma_container_->first_rtp_stats_time_ms_ == -1)
|
||||
@ -530,7 +529,7 @@ void SendStatisticsProxy::Notify(const BitrateStatistics& total_stats,
|
||||
uint32_t ssrc) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
stats->total_bitrate_bps = total_stats.bitrate_bps;
|
||||
@ -541,7 +540,7 @@ void SendStatisticsProxy::FrameCountUpdated(const FrameCounts& frame_counts,
|
||||
uint32_t ssrc) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
|
||||
stats->frame_counts = frame_counts;
|
||||
@ -552,7 +551,7 @@ void SendStatisticsProxy::SendSideDelayUpdated(int avg_delay_ms,
|
||||
uint32_t ssrc) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
|
||||
if (stats == nullptr)
|
||||
if (!stats)
|
||||
return;
|
||||
stats->avg_delay_ms = avg_delay_ms;
|
||||
stats->max_delay_ms = max_delay_ms;
|
||||
|
||||
@ -223,7 +223,7 @@ TEST_F(VideoCaptureInputTest, TestTextureFrameAfterI420Frame) {
|
||||
}
|
||||
|
||||
bool EqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) {
|
||||
if (frame1.native_handle() != NULL || frame2.native_handle() != NULL)
|
||||
if (frame1.native_handle() || frame2.native_handle())
|
||||
return EqualTextureFrames(frame1, frame2);
|
||||
return EqualBufferFrames(frame1, frame2);
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ bool VideoDecoderSoftwareFallbackWrapper::InitFallbackDecoder() {
|
||||
fallback_decoder_.reset();
|
||||
return false;
|
||||
}
|
||||
if (callback_ != nullptr)
|
||||
if (callback_)
|
||||
fallback_decoder_->RegisterDecodeCompleteCallback(callback_);
|
||||
fallback_implementation_name_ =
|
||||
std::string(fallback_decoder_->ImplementationName()) +
|
||||
|
||||
@ -934,9 +934,9 @@ void VideoQualityTest::CreateCapturer(VideoCaptureInput* input) {
|
||||
input, test::ResourcePath(params_.video.clip_name, "yuv"),
|
||||
params_.common.width, params_.common.height, params_.common.fps,
|
||||
clock_));
|
||||
ASSERT_TRUE(capturer_.get() != nullptr)
|
||||
<< "Could not create capturer for " << params_.video.clip_name
|
||||
<< ".yuv. Is this resource file present?";
|
||||
ASSERT_TRUE(capturer_) << "Could not create capturer for "
|
||||
<< params_.video.clip_name
|
||||
<< ".yuv. Is this resource file present?";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -952,7 +952,7 @@ void VideoQualityTest::RunWithAnalyzer(const Params& params) {
|
||||
if (!params_.analyzer.graph_data_output_filename.empty()) {
|
||||
graph_data_output_file =
|
||||
fopen(params_.analyzer.graph_data_output_filename.c_str(), "w");
|
||||
RTC_CHECK(graph_data_output_file != nullptr)
|
||||
RTC_CHECK(graph_data_output_file)
|
||||
<< "Can't open the file " << params_.analyzer.graph_data_output_filename
|
||||
<< "!";
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ static bool UseSendSideBwe(const VideoReceiveStream::Config& config) {
|
||||
|
||||
std::string VideoReceiveStream::Decoder::ToString() const {
|
||||
std::stringstream ss;
|
||||
ss << "{decoder: " << (decoder != nullptr ? "(VideoDecoder)" : "nullptr");
|
||||
ss << "{decoder: " << (decoder ? "(VideoDecoder)" : "nullptr");
|
||||
ss << ", payload_type: " << payload_type;
|
||||
ss << ", payload_name: " << payload_name;
|
||||
ss << '}';
|
||||
@ -59,14 +59,14 @@ std::string VideoReceiveStream::Config::ToString() const {
|
||||
}
|
||||
ss << ']';
|
||||
ss << ", rtp: " << rtp.ToString();
|
||||
ss << ", renderer: " << (renderer != nullptr ? "(renderer)" : "nullptr");
|
||||
ss << ", renderer: " << (renderer ? "(renderer)" : "nullptr");
|
||||
ss << ", render_delay_ms: " << render_delay_ms;
|
||||
if (!sync_group.empty())
|
||||
ss << ", sync_group: " << sync_group;
|
||||
ss << ", pre_decode_callback: "
|
||||
<< (pre_decode_callback != nullptr ? "(EncodedFrameObserver)" : "nullptr");
|
||||
<< (pre_decode_callback ? "(EncodedFrameObserver)" : "nullptr");
|
||||
ss << ", pre_render_callback: "
|
||||
<< (pre_render_callback != nullptr ? "(I420FrameCallback)" : "nullptr");
|
||||
<< (pre_render_callback ? "(I420FrameCallback)" : "nullptr");
|
||||
ss << ", target_delay_ms: " << target_delay_ms;
|
||||
ss << '}';
|
||||
|
||||
@ -345,7 +345,7 @@ void VideoReceiveStream::Stop() {
|
||||
|
||||
void VideoReceiveStream::SetSyncChannel(VoiceEngine* voice_engine,
|
||||
int audio_channel_id) {
|
||||
if (voice_engine != nullptr && audio_channel_id != -1) {
|
||||
if (voice_engine && audio_channel_id != -1) {
|
||||
VoEVideoSync* voe_sync_interface = VoEVideoSync::GetInterface(voice_engine);
|
||||
vie_sync_.ConfigureSync(audio_channel_id, voe_sync_interface, rtp_rtcp_,
|
||||
vie_receiver_->GetRtpReceiver());
|
||||
@ -374,7 +374,7 @@ void VideoReceiveStream::FrameCallback(VideoFrame* video_frame) {
|
||||
stats_proxy_.OnDecodedFrame();
|
||||
|
||||
// Post processing is not supported if the frame is backed by a texture.
|
||||
if (video_frame->native_handle() == NULL) {
|
||||
if (!video_frame->native_handle()) {
|
||||
if (config_.pre_render_callback)
|
||||
config_.pre_render_callback->FrameCallback(video_frame);
|
||||
}
|
||||
@ -386,7 +386,7 @@ int VideoReceiveStream::RenderFrame(const uint32_t /*stream_id*/,
|
||||
if (vie_sync_.GetStreamSyncOffsetInMs(video_frame, &sync_offset_ms))
|
||||
stats_proxy_.OnSyncOffsetUpdated(sync_offset_ms);
|
||||
|
||||
if (config_.renderer != nullptr)
|
||||
if (config_.renderer)
|
||||
config_.renderer->OnFrame(video_frame);
|
||||
|
||||
stats_proxy_.OnRenderedFrame(video_frame);
|
||||
|
||||
@ -39,7 +39,7 @@ VideoSendStream::Config::EncoderSettings::ToString() const {
|
||||
std::stringstream ss;
|
||||
ss << "{payload_name: " << payload_name;
|
||||
ss << ", payload_type: " << payload_type;
|
||||
ss << ", encoder: " << (encoder != nullptr ? "(VideoEncoder)" : "nullptr");
|
||||
ss << ", encoder: " << (encoder ? "(VideoEncoder)" : "nullptr");
|
||||
ss << '}';
|
||||
return ss.str();
|
||||
}
|
||||
@ -94,12 +94,11 @@ std::string VideoSendStream::Config::ToString() const {
|
||||
ss << "{encoder_settings: " << encoder_settings.ToString();
|
||||
ss << ", rtp: " << rtp.ToString();
|
||||
ss << ", pre_encode_callback: "
|
||||
<< (pre_encode_callback != nullptr ? "(I420FrameCallback)" : "nullptr");
|
||||
ss << ", post_encode_callback: " << (post_encode_callback != nullptr
|
||||
? "(EncodedFrameObserver)"
|
||||
: "nullptr");
|
||||
ss << ", local_renderer: " << (local_renderer != nullptr ? "(VideoRenderer)"
|
||||
: "nullptr");
|
||||
<< (pre_encode_callback ? "(I420FrameCallback)" : "nullptr");
|
||||
ss << ", post_encode_callback: "
|
||||
<< (post_encode_callback ? "(EncodedFrameObserver)" : "nullptr");
|
||||
ss << ", local_renderer: "
|
||||
<< (local_renderer ? "(VideoRenderer)" : "nullptr");
|
||||
ss << ", render_delay_ms: " << render_delay_ms;
|
||||
ss << ", target_delay_ms: " << target_delay_ms;
|
||||
ss << ", suspend_below_min_bitrate: " << (suspend_below_min_bitrate ? "on"
|
||||
@ -286,7 +285,7 @@ VideoSendStream::VideoSendStream(
|
||||
config_.encoder_settings.payload_name.c_str());
|
||||
}
|
||||
|
||||
RTC_DCHECK(config.encoder_settings.encoder != nullptr);
|
||||
RTC_DCHECK(config.encoder_settings.encoder);
|
||||
RTC_DCHECK_GE(config.encoder_settings.payload_type, 0);
|
||||
RTC_DCHECK_LE(config.encoder_settings.payload_type, 127);
|
||||
RTC_CHECK_EQ(0, vie_encoder_.RegisterExternalEncoder(
|
||||
@ -428,7 +427,7 @@ void VideoSendStream::ReconfigureVideoEncoder(
|
||||
}
|
||||
|
||||
if (video_codec.codecType == kVideoCodecVP8) {
|
||||
if (config.encoder_specific_settings != nullptr) {
|
||||
if (config.encoder_specific_settings) {
|
||||
video_codec.codecSpecific.VP8 = *reinterpret_cast<const VideoCodecVP8*>(
|
||||
config.encoder_specific_settings);
|
||||
}
|
||||
@ -436,7 +435,7 @@ void VideoSendStream::ReconfigureVideoEncoder(
|
||||
static_cast<unsigned char>(
|
||||
streams.back().temporal_layer_thresholds_bps.size() + 1);
|
||||
} else if (video_codec.codecType == kVideoCodecVP9) {
|
||||
if (config.encoder_specific_settings != nullptr) {
|
||||
if (config.encoder_specific_settings) {
|
||||
video_codec.codecSpecific.VP9 = *reinterpret_cast<const VideoCodecVP9*>(
|
||||
config.encoder_specific_settings);
|
||||
if (video_codec.mode == kScreensharing) {
|
||||
@ -450,13 +449,13 @@ void VideoSendStream::ReconfigureVideoEncoder(
|
||||
static_cast<unsigned char>(
|
||||
streams.back().temporal_layer_thresholds_bps.size() + 1);
|
||||
} else if (video_codec.codecType == kVideoCodecH264) {
|
||||
if (config.encoder_specific_settings != nullptr) {
|
||||
if (config.encoder_specific_settings) {
|
||||
video_codec.codecSpecific.H264 = *reinterpret_cast<const VideoCodecH264*>(
|
||||
config.encoder_specific_settings);
|
||||
}
|
||||
} else {
|
||||
// TODO(pbos): Support encoder_settings codec-agnostically.
|
||||
RTC_DCHECK(config.encoder_specific_settings == nullptr)
|
||||
RTC_DCHECK(!config.encoder_specific_settings)
|
||||
<< "Encoder-specific settings for codec type not wired up.";
|
||||
}
|
||||
|
||||
|
||||
@ -1050,7 +1050,7 @@ TEST_F(VideoSendStreamTest, MinTransmitBitrateRespectsRemb) {
|
||||
RTPHeader header;
|
||||
if (!parser_->Parse(packet, length, &header))
|
||||
return DROP_PACKET;
|
||||
RTC_DCHECK(stream_ != nullptr);
|
||||
RTC_DCHECK(stream_);
|
||||
VideoSendStream::Stats stats = stream_->GetStats();
|
||||
if (!stats.substreams.empty()) {
|
||||
EXPECT_EQ(1u, stats.substreams.size());
|
||||
@ -1245,7 +1245,7 @@ TEST_F(VideoSendStreamTest, CapturesTextureAndVideoFrames) {
|
||||
}
|
||||
|
||||
void ExpectEqualFrames(const VideoFrame& frame1, const VideoFrame& frame2) {
|
||||
if (frame1.native_handle() != nullptr || frame2.native_handle() != nullptr)
|
||||
if (frame1.native_handle() || frame2.native_handle())
|
||||
ExpectEqualTextureFrames(frame1, frame2);
|
||||
else
|
||||
ExpectEqualBufferFrames(frame1, frame2);
|
||||
@ -1859,7 +1859,7 @@ TEST_F(VideoSendStreamTest, ReportsSentResolution) {
|
||||
encoded._frameType = (*frame_types)[i];
|
||||
encoded._encodedWidth = kEncodedResolution[i].width;
|
||||
encoded._encodedHeight = kEncodedResolution[i].height;
|
||||
RTC_DCHECK(callback_ != nullptr);
|
||||
RTC_DCHECK(callback_);
|
||||
if (callback_->Encoded(encoded, &specifics, nullptr) != 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ ViEChannel::ViEChannel(Transport* transport,
|
||||
bandwidth_observer_(bandwidth_observer),
|
||||
transport_feedback_observer_(transport_feedback_observer),
|
||||
max_nack_reordering_threshold_(kMaxPacketAgeToNack),
|
||||
pre_render_callback_(NULL),
|
||||
pre_render_callback_(nullptr),
|
||||
last_rtt_ms_(0),
|
||||
rtp_rtcp_modules_(
|
||||
CreateRtpRtcpModules(!sender,
|
||||
@ -315,7 +315,7 @@ CallStatsObserver* ViEChannel::GetStatsObserver() {
|
||||
int32_t ViEChannel::FrameToRender(VideoFrame& video_frame) { // NOLINT
|
||||
rtc::CritScope lock(&crit_);
|
||||
|
||||
if (pre_render_callback_ != NULL)
|
||||
if (pre_render_callback_)
|
||||
pre_render_callback_->FrameCallback(&video_frame);
|
||||
|
||||
// TODO(pbos): Remove stream id argument.
|
||||
|
||||
@ -201,7 +201,7 @@ class ViEChannel : public VCMFrameTypeCallback,
|
||||
template <class T>
|
||||
class RegisterableCallback : public T {
|
||||
public:
|
||||
RegisterableCallback() : callback_(NULL) {}
|
||||
RegisterableCallback() : callback_(nullptr) {}
|
||||
|
||||
void Set(T* callback) {
|
||||
rtc::CritScope lock(&critsect_);
|
||||
|
||||
@ -166,14 +166,14 @@ int32_t ViEEncoder::RegisterExternalEncoder(webrtc::VideoEncoder* encoder,
|
||||
}
|
||||
|
||||
int32_t ViEEncoder::DeRegisterExternalEncoder(uint8_t pl_type) {
|
||||
if (vcm_->RegisterExternalEncoder(NULL, pl_type) != VCM_OK) {
|
||||
if (vcm_->RegisterExternalEncoder(nullptr, pl_type) != VCM_OK) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void ViEEncoder::SetEncoder(const webrtc::VideoCodec& video_codec,
|
||||
int min_transmit_bitrate_bps) {
|
||||
RTC_DCHECK(send_payload_router_ != NULL);
|
||||
RTC_DCHECK(send_payload_router_);
|
||||
// Setting target width and height for VPM.
|
||||
RTC_CHECK_EQ(VPM_OK,
|
||||
vp_->SetTargetResolution(video_codec.width, video_codec.height,
|
||||
@ -334,7 +334,7 @@ void ViEEncoder::EncodeVideoFrame(const VideoFrame& video_frame) {
|
||||
"Encode");
|
||||
const VideoFrame* frame_to_send = &video_frame;
|
||||
// TODO(wuchengli): support texture frames.
|
||||
if (video_frame.native_handle() == NULL) {
|
||||
if (!video_frame.native_handle()) {
|
||||
// Pass frame via preprocessor.
|
||||
frame_to_send = vp_->PreprocessFrame(video_frame);
|
||||
if (!frame_to_send) {
|
||||
@ -412,14 +412,14 @@ int32_t ViEEncoder::SendData(const uint8_t payload_type,
|
||||
const EncodedImage& encoded_image,
|
||||
const RTPFragmentationHeader* fragmentation_header,
|
||||
const RTPVideoHeader* rtp_video_hdr) {
|
||||
RTC_DCHECK(send_payload_router_ != NULL);
|
||||
RTC_DCHECK(send_payload_router_);
|
||||
|
||||
{
|
||||
rtc::CritScope lock(&data_cs_);
|
||||
time_of_last_frame_activity_ms_ = TickTime::MillisecondTimestamp();
|
||||
}
|
||||
|
||||
if (stats_proxy_ != NULL)
|
||||
if (stats_proxy_)
|
||||
stats_proxy_->OnSendEncodedImage(encoded_image, rtp_video_hdr);
|
||||
|
||||
bool success = send_payload_router_->RoutePayload(
|
||||
@ -485,7 +485,7 @@ void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
|
||||
LOG(LS_VERBOSE) << "OnBitrateUpdated, bitrate" << bitrate_bps
|
||||
<< " packet loss " << static_cast<int>(fraction_lost)
|
||||
<< " rtt " << round_trip_time_ms;
|
||||
RTC_DCHECK(send_payload_router_ != NULL);
|
||||
RTC_DCHECK(send_payload_router_);
|
||||
vcm_->SetChannelParameters(bitrate_bps, fraction_lost, round_trip_time_ms);
|
||||
bool video_is_suspended = vcm_->VideoSuspended();
|
||||
bool video_suspension_changed;
|
||||
|
||||
@ -313,7 +313,7 @@ void ViEReceiver::NotifyReceiverOfFecPacket(const RTPHeader& header) {
|
||||
rtp_header.type.Video.rotation =
|
||||
ConvertCVOByteToVideoRotation(header.extension.videoRotation);
|
||||
}
|
||||
OnReceivedPayloadData(NULL, 0, &rtp_header);
|
||||
OnReceivedPayloadData(nullptr, 0, &rtp_header);
|
||||
}
|
||||
|
||||
bool ViEReceiver::DeliverRtcp(const uint8_t* rtcp_packet,
|
||||
@ -331,7 +331,7 @@ bool ViEReceiver::DeliverRtcp(const uint8_t* rtcp_packet,
|
||||
rtp_rtcp->IncomingRtcpPacket(rtcp_packet, rtcp_packet_length);
|
||||
|
||||
int64_t rtt = 0;
|
||||
rtp_rtcp_[0]->RTT(rtp_receiver_->SSRC(), &rtt, NULL, NULL, NULL);
|
||||
rtp_rtcp_[0]->RTT(rtp_receiver_->SSRC(), &rtt, nullptr, nullptr, nullptr);
|
||||
if (rtt == 0) {
|
||||
// Waiting for valid rtt.
|
||||
return true;
|
||||
@ -339,7 +339,7 @@ bool ViEReceiver::DeliverRtcp(const uint8_t* rtcp_packet,
|
||||
uint32_t ntp_secs = 0;
|
||||
uint32_t ntp_frac = 0;
|
||||
uint32_t rtp_timestamp = 0;
|
||||
if (rtp_rtcp_[0]->RemoteNTP(&ntp_secs, &ntp_frac, NULL, NULL,
|
||||
if (rtp_rtcp_[0]->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr,
|
||||
&rtp_timestamp) != 0) {
|
||||
// Waiting for RTCP.
|
||||
return true;
|
||||
@ -382,7 +382,7 @@ bool ViEReceiver::IsPacketRetransmitted(const RTPHeader& header,
|
||||
return false;
|
||||
// Check if this is a retransmission.
|
||||
int64_t min_rtt = 0;
|
||||
rtp_rtcp_[0]->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL);
|
||||
rtp_rtcp_[0]->RTT(rtp_receiver_->SSRC(), nullptr, nullptr, &min_rtt, nullptr);
|
||||
return !in_order &&
|
||||
statistician->IsRetransmitOfOldPacket(header, min_rtt);
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ bool VieRemb::InUse() const {
|
||||
|
||||
void VieRemb::OnReceiveBitrateChanged(const std::vector<uint32_t>& ssrcs,
|
||||
uint32_t bitrate) {
|
||||
RtpRtcp* sender = NULL;
|
||||
RtpRtcp* sender = nullptr;
|
||||
{
|
||||
rtc::CritScope lock(&list_crit_);
|
||||
// If we already have an estimate, check if the new total estimate is below
|
||||
|
||||
@ -33,11 +33,8 @@ int UpdateMeasurements(StreamSynchronization::Measurements* stream,
|
||||
uint32_t ntp_secs = 0;
|
||||
uint32_t ntp_frac = 0;
|
||||
uint32_t rtp_timestamp = 0;
|
||||
if (0 != rtp_rtcp.RemoteNTP(&ntp_secs,
|
||||
&ntp_frac,
|
||||
NULL,
|
||||
NULL,
|
||||
&rtp_timestamp)) {
|
||||
if (rtp_rtcp.RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr,
|
||||
&rtp_timestamp) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -54,10 +51,10 @@ int UpdateMeasurements(StreamSynchronization::Measurements* stream,
|
||||
ViESyncModule::ViESyncModule(VideoCodingModule* vcm)
|
||||
: vcm_(vcm),
|
||||
clock_(Clock::GetRealTimeClock()),
|
||||
video_receiver_(NULL),
|
||||
video_rtp_rtcp_(NULL),
|
||||
video_receiver_(nullptr),
|
||||
video_rtp_rtcp_(nullptr),
|
||||
voe_channel_id_(-1),
|
||||
voe_sync_interface_(NULL),
|
||||
voe_sync_interface_(nullptr),
|
||||
last_sync_time_(TickTime::Now()),
|
||||
sync_() {}
|
||||
|
||||
@ -113,10 +110,10 @@ void ViESyncModule::Process() {
|
||||
const int current_audio_delay_ms = audio_jitter_buffer_delay_ms +
|
||||
playout_buffer_delay_ms;
|
||||
|
||||
RtpRtcp* voice_rtp_rtcp = NULL;
|
||||
RtpReceiver* voice_receiver = NULL;
|
||||
if (0 != voe_sync_interface_->GetRtpRtcp(voe_channel_id_, &voice_rtp_rtcp,
|
||||
&voice_receiver)) {
|
||||
RtpRtcp* voice_rtp_rtcp = nullptr;
|
||||
RtpReceiver* voice_receiver = nullptr;
|
||||
if (voe_sync_interface_->GetRtpRtcp(voe_channel_id_, &voice_rtp_rtcp,
|
||||
&voice_receiver) != 0) {
|
||||
return;
|
||||
}
|
||||
assert(voice_rtp_rtcp);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user