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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc
index 41a94d53b06141c8c46e0565aa4f2dcf15f3e84c..4fc45a4fe0ef13499bfb9a54a3ff288e98fd8505 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc
@@ -42,7 +42,7 @@ class Vp8SequenceCoderEncodeCallback : public webrtc::EncodedImageCallback {
Vp8SequenceCoderEncodeCallback::~Vp8SequenceCoderEncodeCallback() {
delete[] encoded_image_._buffer;
- encoded_image_._buffer = NULL;
+ encoded_image_._buffer = nullptr;
}
webrtc::EncodedImageCallback::Result
@@ -52,13 +52,13 @@ Vp8SequenceCoderEncodeCallback::OnEncodedImage(
const webrtc::RTPFragmentationHeader* fragmentation) {
if (encoded_image_._size < encoded_image._size) {
delete[] encoded_image_._buffer;
- encoded_image_._buffer = NULL;
+ encoded_image_._buffer = nullptr;
encoded_image_._buffer = new uint8_t[encoded_image._size];
encoded_image_._size = encoded_image._size;
}
memcpy(encoded_image_._buffer, encoded_image._buffer, encoded_image._size);
encoded_image_._length = encoded_image._length;
- if (encoded_file_ != NULL) {
+ if (encoded_file_ != nullptr) {
if (fwrite(encoded_image._buffer, 1, encoded_image._length,
encoded_file_) != encoded_image._length) {
return Result(Result::ERROR_SEND_FAILED, 0);
@@ -90,15 +90,15 @@ int Vp8SequenceCoderDecodeCallback::Decoded(webrtc::VideoFrame& image) {
}
int SequenceCoder(webrtc::test::CommandLineParser* parser) {
- int width = strtol((parser->GetFlag("w")).c_str(), NULL, 10);
- int height = strtol((parser->GetFlag("h")).c_str(), NULL, 10);
- int framerate = strtol((parser->GetFlag("f")).c_str(), NULL, 10);
+ int width = strtol((parser->GetFlag("w")).c_str(), nullptr, 10);
+ int height = strtol((parser->GetFlag("h")).c_str(), nullptr, 10);
+ int framerate = strtol((parser->GetFlag("f")).c_str(), nullptr, 10);
if (width <= 0 || height <= 0 || framerate <= 0) {
fprintf(stderr, "Error: Resolution cannot be <= 0!\n");
return -1;
}
- int target_bitrate = strtol((parser->GetFlag("b")).c_str(), NULL, 10);
+ int target_bitrate = strtol((parser->GetFlag("b")).c_str(), nullptr, 10);
if (target_bitrate <= 0) {
fprintf(stderr, "Error: Bit-rate cannot be <= 0!\n");
return -1;
@@ -108,27 +108,28 @@ int SequenceCoder(webrtc::test::CommandLineParser* parser) {
// Open input file.
std::string encoded_file_name = parser->GetFlag("encoded_file");
FILE* encoded_file = fopen(encoded_file_name.c_str(), "wb");
- if (encoded_file == NULL) {
+ if (encoded_file == nullptr) {
fprintf(stderr, "Error: Cannot open encoded file\n");
return -1;
}
std::string input_file_name = parser->GetFlag("input_file");
FILE* input_file = fopen(input_file_name.c_str(), "rb");
- if (input_file == NULL) {
+ if (input_file == nullptr) {
fprintf(stderr, "Error: Cannot open input file\n");
return -1;
}
// Open output file.
std::string output_file_name = parser->GetFlag("output_file");
FILE* output_file = fopen(output_file_name.c_str(), "wb");
- if (output_file == NULL) {
+ if (output_file == nullptr) {
fprintf(stderr, "Error: Cannot open output file\n");
return -1;
}
// Get range of frames: will encode num_frames following start_frame).
- int start_frame = strtol((parser->GetFlag("start_frame")).c_str(), NULL, 10);
- int num_frames = strtol((parser->GetFlag("num_frames")).c_str(), NULL, 10);
+ int start_frame =
+ strtol((parser->GetFlag("start_frame")).c_str(), nullptr, 10);
+ int num_frames = strtol((parser->GetFlag("num_frames")).c_str(), nullptr, 10);
// Codec SetUp.
webrtc::VideoCodec inst;
@@ -172,9 +173,9 @@ int SequenceCoder(webrtc::test::CommandLineParser* parser) {
break;
}
if (frame_cnt >= start_frame) {
- encoder->Encode(VideoFrame(buffer, webrtc::kVideoRotation_0, 0),
- NULL, NULL);
- decoder->Decode(encoder_callback.encoded_image(), false, NULL);
+ encoder->Encode(VideoFrame(buffer, webrtc::kVideoRotation_0, 0), nullptr,
+ nullptr);
+ decoder->Decode(encoder_callback.encoded_image(), false, nullptr);
++frames_processed;
}
++frame_cnt;

Powered by Google App Engine
This is Rietveld 408576698