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

Unified Diff: media/bench/bench.cc

Issue 265050: Add -loop=N option to test ffmpeg ogv decoding on loop. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698