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

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

Issue 2362683002: New helper function test::ReadI420Buffer, refactor FrameReader to use it. (Closed)
Patch Set: Another try to fix the 64-bit windows build. Created 4 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 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 dcc061987fadf4cb6e7a7c6595c2c086ae4d0747..e246ad24c390a22d990ffa970d0c710de0cef87c 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc
@@ -163,19 +163,16 @@ int SequenceCoder(webrtc::test::CommandLineParser* parser) {
int64_t starttime = rtc::TimeMillis();
int frame_cnt = 1;
int frames_processed = 0;
- rtc::scoped_refptr<webrtc::I420Buffer> i420_buffer =
- webrtc::I420Buffer::Create(width, height, width, half_width, half_width);
-
- while (!feof(input_file) &&
- (num_frames == -1 || frames_processed < num_frames)) {
- if (fread(frame_buffer.get(), 1, length, input_file) != length)
- continue;
+ while (num_frames == -1 || frames_processed < num_frames) {
+ rtc::scoped_refptr<VideoFrameBuffer> buffer(
+ test::ReadI420Buffer(width, height, input_file));
+ if (!buffer) {
+ // EOF or read error.
+ break;
+ }
if (frame_cnt >= start_frame) {
- webrtc::ConvertToI420(webrtc::kI420, frame_buffer.get(), 0, 0, width,
- height, 0, webrtc::kVideoRotation_0, &i420_buffer);
- webrtc::VideoFrame input_frame(i420_buffer, 0, 0,
- webrtc::kVideoRotation_0);
- encoder->Encode(input_frame, NULL, NULL);
+ encoder->Encode(VideoFrame(buffer, webrtc::kVideoRotation_0, 0),
+ NULL, NULL);
decoder->Decode(encoder_callback.encoded_image(), false, NULL);
++frames_processed;
}

Powered by Google App Engine
This is Rietveld 408576698