summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 09:40:46 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 09:40:46 +0000
commitef1f6d8071ed54a6126d2a963feef8d37283cbff (patch)
treef53dc1e1622a446262902fe2d93c0e7fe49da055 /media
parenta9e132387cacf1abe875409010ab7ee45faa3635 (diff)
downloadchromium_src-ef1f6d8071ed54a6126d2a963feef8d37283cbff.zip
chromium_src-ef1f6d8071ed54a6126d2a963feef8d37283cbff.tar.gz
chromium_src-ef1f6d8071ed54a6126d2a963feef8d37283cbff.tar.bz2
Add -loop=N option to test ffmpeg ogv decoding on loop.
BUG=19917 TEST=media_bench.exe -stream=video -loop=100 d:\testmatrix\still\still1.ogv still.1280x720_30Hz_P420.yuv should produce 100 frames and not black. Use pyuv on still.1280x720_30Hz_P420.yuv to confirm. Review URL: http://codereview.chromium.org/265050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/bench/bench.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/media/bench/bench.cc b/media/bench/bench.cc
index 8b3cdbf..366abdd 100644
--- a/media/bench/bench.cc
+++ b/media/bench/bench.cc
@@ -42,6 +42,7 @@ const wchar_t kFlush[] = L"flush";
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 @@ int main(int argc, const char** argv) {
<< "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 @@ int main(int argc, const char** argv) {
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 @@ int main(int argc, const char** argv) {
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 @@ int main(int argc, const char** argv) {
} while (read_result >= 0);
base::TimeDelta total = base::TimeTicks::HighResNow() - start;
LeaveTimingSection();
+
if (output)
file_util::CloseFile(output);