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

Side by Side Diff: media/test/ffmpeg_tests/ffmpeg_tests.cc

Issue 7466003: MD5Update function uses StringPiece instead of raw buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added valid license Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Software qualification test for FFmpeg. This test is used to certify that 5 // Software qualification test for FFmpeg. This test is used to certify that
6 // software decoding quality and performance of FFmpeg meets a mimimum 6 // software decoding quality and performance of FFmpeg meets a mimimum
7 // standard. 7 // standard.
8 8
9 #include <iomanip> 9 #include <iomanip>
10 #include <iostream> 10 #include <iostream>
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 << std::endl; 309 << std::endl;
310 return 1; 310 return 1;
311 } 311 }
312 } 312 }
313 313
314 const uint8* u8_samples = 314 const uint8* u8_samples =
315 reinterpret_cast<const uint8*>(samples.get()); 315 reinterpret_cast<const uint8*>(samples.get());
316 if (hash_djb2) { 316 if (hash_djb2) {
317 hash_value = DJB2Hash(u8_samples, size_out, hash_value); 317 hash_value = DJB2Hash(u8_samples, size_out, hash_value);
318 } 318 }
319 if (hash_md5) 319 if (hash_md5) {
320 base::MD5Update(&ctx, u8_samples, size_out); 320 base::MD5Update(
321 &ctx,
322 base::StringPiece(
323 reinterpret_cast<const char*>(u8_samples), size_out));
324 }
321 } 325 }
322 } else if (target_codec == AVMEDIA_TYPE_VIDEO) { 326 } else if (target_codec == AVMEDIA_TYPE_VIDEO) {
323 int got_picture = 0; 327 int got_picture = 0;
324 328
325 base::TimeTicks decode_start = base::TimeTicks::HighResNow(); 329 base::TimeTicks decode_start = base::TimeTicks::HighResNow();
326 result = avcodec_decode_video2(codec_context, frame.get(), 330 result = avcodec_decode_video2(codec_context, frame.get(),
327 &got_picture, &packet); 331 &got_picture, &packet);
328 base::TimeDelta delta = base::TimeTicks::HighResNow() - decode_start; 332 base::TimeDelta delta = base::TimeTicks::HighResNow() - decode_start;
329 333
330 if (got_picture) { 334 if (got_picture) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 374 }
371 } 375 }
372 if (hash_djb2) { 376 if (hash_djb2) {
373 for (size_t i = 0; i < copy_lines; ++i) { 377 for (size_t i = 0; i < copy_lines; ++i) {
374 hash_value = DJB2Hash(source, bytes_per_line, hash_value); 378 hash_value = DJB2Hash(source, bytes_per_line, hash_value);
375 source += source_stride; 379 source += source_stride;
376 } 380 }
377 } 381 }
378 if (hash_md5) { 382 if (hash_md5) {
379 for (size_t i = 0; i < copy_lines; ++i) { 383 for (size_t i = 0; i < copy_lines; ++i) {
380 base::MD5Update(&ctx, reinterpret_cast<const uint8*>(source), 384 base::MD5Update(
381 bytes_per_line); 385 &ctx,
386 base::StringPiece(reinterpret_cast<const char*>(source),
387 bytes_per_line));
382 source += source_stride; 388 source += source_stride;
383 } 389 }
384 } 390 }
385 } 391 }
386 } 392 }
387 } else { 393 } else {
388 NOTREACHED(); 394 NOTREACHED();
389 } 395 }
390 396
391 // Make sure our decoding went OK. 397 // Make sure our decoding went OK.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 #if defined(ENABLE_WINDOWS_EXCEPTIONS) 496 #if defined(ENABLE_WINDOWS_EXCEPTIONS)
491 } __except(EXCEPTION_EXECUTE_HANDLER) { 497 } __except(EXCEPTION_EXECUTE_HANDLER) {
492 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() 498 *log_out << " Exception:" << std::setw(11) << GetExceptionCode()
493 << " " << in_path.value() << std::endl; 499 << " " << in_path.value() << std::endl;
494 return 1; 500 return 1;
495 } 501 }
496 #endif 502 #endif
497 CommandLine::Reset(); 503 CommandLine::Reset();
498 return 0; 504 return 0;
499 } 505 }
500
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698