[vlc-commits] android: display: render opaque buffers earlier
Thomas Guillem
git at videolan.org
Wed Oct 25 19:16:02 CEST 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Oct 25 19:04:29 2017 +0200| [a55b0a51119264f3908ef9550aa0f8f866097d30] | committer: Thomas Guillem
android: display: render opaque buffers earlier
Using releaseOutputBufferAtTime() (if available).
Fixes #18912
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a55b0a51119264f3908ef9550aa0f8f866097d30
---
modules/video_output/android/display.c | 12 ++++++++++++
modules/video_output/android/display.h | 29 +++++++++++++++++++++++++++--
2 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/modules/video_output/android/display.c b/modules/video_output/android/display.c
index 1d4e774913..a5b9c39738 100644
--- a/modules/video_output/android/display.c
+++ b/modules/video_output/android/display.c
@@ -1141,6 +1141,18 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
sys->b_has_subpictures = false;
}
}
+ if (sys->p_window->b_opaque
+ && AndroidOpaquePicture_CanReleaseAtTime(picture->p_sys))
+ {
+ mtime_t now = mdate();
+ if (picture->date > now)
+ {
+ if (picture->date - now <= INT64_C(1000000))
+ AndroidOpaquePicture_ReleaseAtTime(picture->p_sys, picture->date);
+ else /* The picture will be displayed from the Display callback */
+ msg_Warn(vd, "picture way too early to release at time");
+ }
+ }
}
static void Display(vout_display_t *vd, picture_t *picture,
diff --git a/modules/video_output/android/display.h b/modules/video_output/android/display.h
index 65c2ad6283..cf94be5027 100644
--- a/modules/video_output/android/display.h
+++ b/modules/video_output/android/display.h
@@ -49,6 +49,8 @@ struct picture_sys_t
int i_index;
void (*pf_release)(decoder_t *p_dec, unsigned int i_index,
bool b_render);
+ void (*pf_release_ts)(decoder_t *p_dec, unsigned int i_index,
+ mtime_t i_ts);
} hw;
struct {
vout_display_sys_t *p_vd_sys;
@@ -112,12 +114,35 @@ AndroidOpaquePicture_Release(picture_sys_t *p_picsys, bool b_render)
{
assert(p_picsys->hw.pf_release && p_picsys->hw.p_dec);
p_picsys->hw.pf_release(p_picsys->hw.p_dec,
- (unsigned int) p_picsys->hw.i_index,
- b_render);
+ (unsigned int) p_picsys->hw.i_index,
+ b_render);
p_picsys->hw.i_index = -1;
}
vlc_mutex_unlock(&p_picsys->hw.lock);
p_picsys->b_locked = false;
}
+static inline void
+AndroidOpaquePicture_ReleaseAtTime(picture_sys_t *p_picsys, mtime_t i_ts)
+{
+ if (!p_picsys->b_locked)
+ return;
+ vlc_mutex_lock(&p_picsys->hw.lock);
+ if (p_picsys->hw.i_index >= 0)
+ {
+ assert(p_picsys->hw.pf_release_ts && p_picsys->hw.p_dec);
+ p_picsys->hw.pf_release_ts(p_picsys->hw.p_dec,
+ (unsigned int) p_picsys->hw.i_index, i_ts);
+ p_picsys->hw.i_index = -1;
+ }
+ vlc_mutex_unlock(&p_picsys->hw.lock);
+ p_picsys->b_locked = false;
+}
+
+static inline bool
+AndroidOpaquePicture_CanReleaseAtTime(picture_sys_t *p_picsys)
+{
+ return p_picsys->hw.pf_release_ts != NULL;
+}
+
#endif
More information about the vlc-commits
mailing list