Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
8e07ff9c
Commit
8e07ff9c
authored
Jul 10, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved out the code retreiving a decoded picture from ThreadDisplayPicture.
No functional changes.
parent
b8a46d56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
86 additions
and
71 deletions
+86
-71
src/video_output/video_output.c
src/video_output/video_output.c
+86
-71
No files found.
src/video_output/video_output.c
View file @
8e07ff9c
...
...
@@ -549,88 +549,103 @@ static int VoutVideoFilterAllocationSetup(filter_t *filter, void *data)
}
/* */
static
int
ThreadDisplayPicture
(
vout_thread_t
*
vout
,
bool
now
,
mtime_t
*
deadline
)
static
picture_t
*
ThreadDisplayGetDecodedPicture
(
vout_thread_t
*
vout
,
int
*
lost_count
,
bool
*
is_forced
,
bool
now
,
mtime_t
*
deadline
)
{
vout_display_t
*
vd
=
vout
->
p
->
display
.
vd
;
int
displayed_count
=
0
;
int
lost_count
=
0
;
for
(;;)
{
const
mtime_t
date
=
mdate
();
const
bool
is_paused
=
vout
->
p
->
pause
.
is_on
;
bool
redisplay
=
is_paused
&&
!
now
&&
vout
->
p
->
displayed
.
decoded
;
bool
is_forced
;
/* FIXME/XXX we must redisplay the last decoded picture (because
* of potential vout updated, or filters update or SPU update)
* For now a high update period is needed but it coulmd be removed
* if and only if:
* - vout module emits events from theselves.
* - *and* SPU is modified to emit an event or a deadline when needed.
*
* So it will be done latter.
*/
if
(
!
redisplay
)
{
picture_t
*
peek
=
picture_fifo_Peek
(
vout
->
p
->
decoder_fifo
);
if
(
peek
)
{
is_forced
=
peek
->
b_force
||
is_paused
||
now
;
*
deadline
=
(
is_forced
?
date
:
peek
->
date
)
-
vout_chrono_GetHigh
(
&
vout
->
p
->
render
);
picture_Release
(
peek
);
}
else
{
redisplay
=
true
;
}
const
mtime_t
date
=
mdate
();
const
bool
is_paused
=
vout
->
p
->
pause
.
is_on
;
bool
redisplay
=
is_paused
&&
!
now
&&
vout
->
p
->
displayed
.
decoded
;
/* FIXME/XXX we must redisplay the last decoded picture (because
* of potential vout updated, or filters update or SPU update)
* For now a high update period is needed but it coulmd be removed
* if and only if:
* - vout module emits events from theselves.
* - *and* SPU is modified to emit an event or a deadline when needed.
*
* So it will be done latter.
*/
if
(
!
redisplay
)
{
picture_t
*
peek
=
picture_fifo_Peek
(
vout
->
p
->
decoder_fifo
);
if
(
peek
)
{
*
is_forced
=
peek
->
b_force
||
is_paused
||
now
;
*
deadline
=
(
*
is_forced
?
date
:
peek
->
date
)
-
vout_chrono_GetHigh
(
&
vout
->
p
->
render
);
picture_Release
(
peek
);
}
else
{
redisplay
=
true
;
}
if
(
redisplay
)
{
/* FIXME a better way for this delay is needed */
const
mtime_t
date_update
=
vout
->
p
->
displayed
.
date
+
VOUT_REDISPLAY_DELAY
;
if
(
date_update
>
date
||
!
vout
->
p
->
displayed
.
decoded
)
{
*
deadline
=
vout
->
p
->
displayed
.
decoded
?
date_update
:
VLC_TS_INVALID
;
break
;
}
/* */
is_forced
=
true
;
*
deadline
=
date
-
vout_chrono_GetHigh
(
&
vout
->
p
->
render
);
}
if
(
redisplay
)
{
/* FIXME a better way for this delay is needed */
const
mtime_t
date_update
=
vout
->
p
->
displayed
.
date
+
VOUT_REDISPLAY_DELAY
;
if
(
date_update
>
date
||
!
vout
->
p
->
displayed
.
decoded
)
{
*
deadline
=
vout
->
p
->
displayed
.
decoded
?
date_update
:
VLC_TS_INVALID
;
return
NULL
;
}
if
(
*
deadline
>
VOUT_MWAIT_TOLERANCE
)
*
deadline
-=
VOUT_MWAIT_TOLERANCE
;
/* */
*
is_forced
=
true
;
*
deadline
=
date
-
vout_chrono_GetHigh
(
&
vout
->
p
->
render
);
}
if
(
*
deadline
>
VOUT_MWAIT_TOLERANCE
)
*
deadline
-=
VOUT_MWAIT_TOLERANCE
;
/* If we are too early and can wait, do it */
if
(
date
<
*
deadline
&&
!
now
)
break
;
/* If we are too early and can wait, do it */
if
(
date
<
*
deadline
&&
!
now
)
return
NULL
;
picture_t
*
decoded
;
if
(
redisplay
)
{
decoded
=
vout
->
p
->
displayed
.
decoded
;
vout
->
p
->
displayed
.
decoded
=
NULL
;
}
else
{
decoded
=
picture_fifo_Pop
(
vout
->
p
->
decoder_fifo
);
assert
(
decoded
);
if
(
!
is_forced
&&
!
vout
->
p
->
is_late_dropped
)
{
const
mtime_t
predicted
=
date
+
vout_chrono_GetLow
(
&
vout
->
p
->
render
);
const
mtime_t
late
=
predicted
-
decoded
->
date
;
if
(
late
>
0
)
{
msg_Dbg
(
vout
,
"picture might be displayed late (missing %d ms)"
,
(
int
)(
late
/
1000
));
if
(
late
>
VOUT_DISPLAY_LATE_THRESHOLD
)
{
msg_Warn
(
vout
,
"rejected picture because of render time"
);
/* TODO */
picture_Release
(
decoded
);
lost_count
++
;
break
;
}
picture_t
*
decoded
;
if
(
redisplay
)
{
decoded
=
vout
->
p
->
displayed
.
decoded
;
vout
->
p
->
displayed
.
decoded
=
NULL
;
}
else
{
decoded
=
picture_fifo_Pop
(
vout
->
p
->
decoder_fifo
);
assert
(
decoded
);
if
(
!*
is_forced
&&
!
vout
->
p
->
is_late_dropped
)
{
const
mtime_t
predicted
=
date
+
vout_chrono_GetLow
(
&
vout
->
p
->
render
);
const
mtime_t
late
=
predicted
-
decoded
->
date
;
if
(
late
>
0
)
{
msg_Dbg
(
vout
,
"picture might be displayed late (missing %d ms)"
,
(
int
)(
late
/
1000
));
if
(
late
>
VOUT_DISPLAY_LATE_THRESHOLD
)
{
msg_Warn
(
vout
,
"rejected picture because of render time"
);
/* TODO */
picture_Release
(
decoded
);
(
*
lost_count
)
++
;
return
NULL
;
}
}
vout
->
p
->
displayed
.
is_interlaced
=
!
decoded
->
b_progressive
;
vout
->
p
->
displayed
.
qtype
=
decoded
->
i_qtype
;
}
vout
->
p
->
displayed
.
timestamp
=
decoded
->
date
;
/* */
if
(
vout
->
p
->
displayed
.
decoded
)
picture_Release
(
vout
->
p
->
displayed
.
decoded
);
picture_Hold
(
decoded
);
vout
->
p
->
displayed
.
decoded
=
decoded
;
vout
->
p
->
displayed
.
is_interlaced
=
!
decoded
->
b_progressive
;
vout
->
p
->
displayed
.
qtype
=
decoded
->
i_qtype
;
}
vout
->
p
->
displayed
.
timestamp
=
decoded
->
date
;
/* */
if
(
vout
->
p
->
displayed
.
decoded
)
picture_Release
(
vout
->
p
->
displayed
.
decoded
);
picture_Hold
(
decoded
);
vout
->
p
->
displayed
.
decoded
=
decoded
;
return
decoded
;
}
static
int
ThreadDisplayPicture
(
vout_thread_t
*
vout
,
bool
now
,
mtime_t
*
deadline
)
{
vout_display_t
*
vd
=
vout
->
p
->
display
.
vd
;
int
displayed_count
=
0
;
int
lost_count
=
0
;
for
(;;)
{
bool
is_forced
;
picture_t
*
decoded
=
ThreadDisplayGetDecodedPicture
(
vout
,
&
lost_count
,
&
is_forced
,
now
,
deadline
);
if
(
!
decoded
)
break
;
/* */
vout_chrono_Start
(
&
vout
->
p
->
render
);
...
...
Write
Preview
Markdown
is supported
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