Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Timothy B. Terriberry
rav1e
Commits
0adf438b
Commit
0adf438b
authored
May 27, 2019
by
Luca Barbato
Committed by
Luca Barbato
May 28, 2019
Browse files
Do not hold the stderr lock
Otherwise trying to use `eprintln!` and `dbg!` would lead to an hang.
parent
c3c35e94
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/bin/rav1e.rs
View file @
0adf438b
...
...
@@ -102,7 +102,7 @@ fn write_stats_file<T: Pixel>(ctx: &Context<T>, filename: &Path) -> Result<(), i
fn
do_encode
<
T
:
Pixel
,
D
:
Decoder
>
(
cfg
:
Config
,
verbose
:
bool
,
mut
progress
:
ProgressInfo
,
mut
err
:
std
::
io
::
StderrLock
,
mut
output
:
&
mut
dyn
Write
,
mut
output
:
&
mut
dyn
Write
,
source
:
&
mut
Source
<
D
>
,
mut
y4m_enc
:
Option
<
y4m
::
Encoder
<
'_
,
Box
<
dyn
Write
>>>
)
{
...
...
@@ -114,10 +114,10 @@ fn do_encode<T: Pixel, D: Decoder>(
{
for
frame
in
frame_info
{
progress
.add_frame
(
frame
);
let
_
=
if
verbose
{
writeln!
(
err
,
"{} - {}"
,
frame
,
progress
)
if
verbose
{
eprintln!
(
"{} - {}"
,
frame
,
progress
)
;
}
else
{
write!
(
err
,
"
\r
{} "
,
progress
)
eprint!
(
"
\r
{} "
,
progress
)
;
};
}
...
...
@@ -128,10 +128,10 @@ fn do_encode<T: Pixel, D: Decoder>(
if
let
Err
(
e
)
=
write_stats_file
(
&
ctx
,
cfg
.enc.stats_file
.as_ref
()
.unwrap
())
{
let
_
=
writeln!
(
err
,
"
\n
Error: Failed to write stats file! {}
\n
"
,
e
);
eprintln!
(
"
\n
Error: Failed to write stats file! {}
\n
"
,
e
);
}
}
let
_
=
write!
(
err
,
"
\n
{}
\n
"
,
progress
.print_summary
());
eprint!
(
"
\n
{}
\n
"
,
progress
.print_summary
());
}
fn
main
()
{
...
...
@@ -162,12 +162,7 @@ fn main() {
threads
:
cli
.threads
,
};
let
stderr
=
io
::
stderr
();
let
mut
err
=
stderr
.lock
();
let
_
=
writeln!
(
err
,
"{}x{} @ {}/{} fps"
,
eprintln!
(
"{}x{} @ {}/{} fps"
,
video_info
.width
,
video_info
.height
,
video_info
.time_base.den
,
...
...
@@ -196,11 +191,11 @@ fn main() {
if
video_info
.bit_depth
==
8
{
do_encode
::
<
u8
,
y4m
::
Decoder
<
'_
,
Box
<
dyn
Read
>>>
(
cfg
,
cli
.verbose
,
progress
,
err
,
&
mut
cli
.io.output
,
&
mut
source
,
y4m_enc
cfg
,
cli
.verbose
,
progress
,
&
mut
cli
.io.output
,
&
mut
source
,
y4m_enc
)
}
else
{
do_encode
::
<
u16
,
y4m
::
Decoder
<
'_
,
Box
<
dyn
Read
>>>
(
cfg
,
cli
.verbose
,
progress
,
err
,
&
mut
cli
.io.output
,
&
mut
source
,
y4m_enc
cfg
,
cli
.verbose
,
progress
,
&
mut
cli
.io.output
,
&
mut
source
,
y4m_enc
)
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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