| Index: media/bench/bench.cc
|
| ===================================================================
|
| --- media/bench/bench.cc (revision 28460)
|
| +++ media/bench/bench.cc (working copy)
|
| @@ -42,6 +42,7 @@
|
| const wchar_t kDjb2[] = L"djb2";
|
| const wchar_t kMd5[] = L"md5";
|
| const wchar_t kFrames[] = L"frames";
|
| +const wchar_t kLoop[] = L"loop";
|
|
|
| } // namespace switches
|
|
|
| @@ -104,6 +105,8 @@
|
| << "Set FFmpeg log verbosity (-8 to 48)\n"
|
| << " --frames=N "
|
| << "Decode N frames\n"
|
| + << " --loop=N "
|
| + << "Loop N times\n"
|
| << " --fast2 "
|
| << "Enable fast2 flag\n"
|
| << " --flush "
|
| @@ -170,6 +173,14 @@
|
| max_frames = 0;
|
| }
|
|
|
| + // Determine number of times to loop (optional).
|
| + int max_loops = 0;
|
| + std::wstring loop_opt(cmd_line->GetSwitchValue(switches::kLoop));
|
| + if (!loop_opt.empty() &&
|
| + !StringToInt(WideToUTF16Hack(loop_opt), &max_loops)) {
|
| + max_loops = 0;
|
| + }
|
| +
|
| bool fast2 = false;
|
| if (cmd_line->HasSwitch(switches::kFast2)) {
|
| fast2 = true;
|
| @@ -341,6 +352,14 @@
|
| read_result = av_read_frame(format_context, &packet);
|
|
|
| if (read_result < 0) {
|
| + if (max_loops) {
|
| + --max_loops;
|
| + }
|
| + if (max_loops > 0) {
|
| + av_seek_frame(format_context, -1, 0, AVSEEK_FLAG_BACKWARD);
|
| + read_result = 0;
|
| + continue;
|
| + }
|
| if (flush) {
|
| packet.stream_index = target_stream;
|
| packet.size = 0;
|
| @@ -466,6 +485,7 @@
|
| } while (read_result >= 0);
|
| base::TimeDelta total = base::TimeTicks::HighResNow() - start;
|
| LeaveTimingSection();
|
| +
|
| if (output)
|
| file_util::CloseFile(output);
|
|
|
|
|