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

Side by Side Diff: content/common/gpu/media/vaapi_h264_decoder_unittest.cc

Issue 614893004: Refactor AppendToFile and WriteFileDescriptor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 // This has to be included first. 7 // This has to be included first.
8 // See http://code.google.com/p/googletest/issues/detail?id=371 8 // See http://code.google.com/p/googletest/issues/detail?id=371
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 const scoped_refptr<media::VideoFrame>& frame) { 242 const scoped_refptr<media::VideoFrame>& frame) {
243 frame->HashFrameForTesting(&md5_context_); 243 frame->HashFrameForTesting(&md5_context_);
244 244
245 if (output_file_.empty()) 245 if (output_file_.empty())
246 return true; 246 return true;
247 247
248 for (size_t i = 0; i < media::VideoFrame::NumPlanes(frame->format()); i++) { 248 for (size_t i = 0; i < media::VideoFrame::NumPlanes(frame->format()); i++) {
249 int to_write = media::VideoFrame::PlaneAllocationSize( 249 int to_write = media::VideoFrame::PlaneAllocationSize(
250 frame->format(), i, frame->coded_size()); 250 frame->format(), i, frame->coded_size());
251 const char* buf = reinterpret_cast<const char*>(frame->data(i)); 251 const char* buf = reinterpret_cast<const char*>(frame->data(i));
252 int written = base::AppendToFile(output_file_, buf, to_write); 252 if (!base::AppendToFile(output_file_, buf, to_write))
253 if (written != to_write)
254 return false; 253 return false;
255 } 254 }
256 return true; 255 return true;
257 } 256 }
258 257
259 void VaapiH264DecoderLoop::OutputPicture( 258 void VaapiH264DecoderLoop::OutputPicture(
260 int32 input_id, 259 int32 input_id,
261 const scoped_refptr<VASurface>& va_surface) { 260 const scoped_refptr<VASurface>& va_surface) {
262 VLOG(1) << "OutputPicture: picture " << num_outputted_pictures_++; 261 VLOG(1) << "OutputPicture: picture " << num_outputted_pictures_++;
263 262
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 content::g_md5sum = it->second; 376 content::g_md5sum = it->second;
378 continue; 377 continue;
379 } 378 }
380 if (it->first == "v" || it->first == "vmodule") 379 if (it->first == "v" || it->first == "vmodule")
381 continue; 380 continue;
382 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; 381 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second;
383 } 382 }
384 383
385 return RUN_ALL_TESTS(); 384 return RUN_ALL_TESTS();
386 } 385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698