Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Strogin
flac
Commits
a3059c96
Commit
a3059c96
authored
Sep 26, 2004
by
Josh Coalson
Browse files
for the first 20 seeks, always seek to the first and last 10 samples before starting random seeking
parent
732dbb2b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test_seeking/main.c
View file @
a3059c96
...
...
@@ -212,11 +212,21 @@ static FLAC__bool seek_barrage_native_flac(const char *filename, unsigned count)
for
(
i
=
0
;
!
stop_signal_
&&
(
count
==
0
||
i
<
count
);
i
++
)
{
FLAC__uint64
pos
;
/* for the first 10, seek to the first 10 samples */
if
(
n
>=
10
&&
i
<
10
)
{
pos
=
i
;
}
/* for the second 10, seek to the last 10 samples */
else
if
(
n
>=
10
&&
i
<
20
)
{
pos
=
n
-
1
-
(
i
-
10
);
}
else
{
#if !defined _MSC_VER && !defined __MINGW32__
pos
=
(
FLAC__uint64
)(
random
()
%
n
);
pos
=
(
FLAC__uint64
)(
random
()
%
n
);
#else
pos
=
(
FLAC__uint64
)(
rand
()
%
n
);
pos
=
(
FLAC__uint64
)(
rand
()
%
n
);
#endif
}
printf
(
"seek(%llu)... "
,
pos
);
fflush
(
stdout
);
...
...
@@ -292,11 +302,21 @@ static FLAC__bool seek_barrage_ogg_flac(const char *filename, unsigned count)
for
(
i
=
0
;
!
stop_signal_
&&
(
count
==
0
||
i
<
count
);
i
++
)
{
FLAC__uint64
pos
;
/* for the first 10, seek to the first 10 samples */
if
(
n
>=
10
&&
i
<
10
)
{
pos
=
i
;
}
/* for the second 10, seek to the last 10 samples */
else
if
(
n
>=
10
&&
i
<
20
)
{
pos
=
n
-
1
-
(
i
-
10
);
}
else
{
#if !defined _MSC_VER && !defined __MINGW32__
pos
=
(
FLAC__uint64
)(
random
()
%
n
);
pos
=
(
FLAC__uint64
)(
random
()
%
n
);
#else
pos
=
(
FLAC__uint64
)(
rand
()
%
n
);
pos
=
(
FLAC__uint64
)(
rand
()
%
n
);
#endif
}
printf
(
"seek(%llu)... "
,
pos
);
fflush
(
stdout
);
...
...
@@ -339,6 +359,9 @@ int main(int argc, char *argv[])
if
(
argc
>
2
)
count
=
strtoul
(
argv
[
2
],
0
,
10
);
if
(
count
<
20
)
fprintf
(
stderr
,
"WARNING: random seeks don't kick in until after 20 preprogrammed ones
\n
"
);
#if !defined _MSC_VER && !defined __MINGW32__
{
struct
timeval
tv
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment