[vlc-devel] [PATCH] Let the threshold for discarding late displays be specified, on the command line

David R. Robison david.robison at openroadsconsulting.com
Mon Mar 30 16:58:48 CEST 2015


Good point. Here is the revised patch.

diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 46180f5..7293a6d 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -482,6 +482,10 @@ static const char *const ppsz_pos_descriptions[] =
  #define MOUSE_EVENTS_LONGTEXT N_( \
      "This enables handling of mouse clicks on the video." )

+#define DISPLAY_LATE_THRESHOLD_TEXT N_("Display late threshold")
+#define DISPLAY_LATE_THRESHOLD_LONGTEXT N_( \
+    "VOUT Display late threshold in ms." )
+
  /*****************************************************************************
   * Input
****************************************************************************/
@@ -1605,6 +1609,9 @@ vlc_module_begin ()
      add_module_list( "video-splitter", "video splitter", NULL,
                       VIDEO_SPLITTER_TEXT, VIDEO_SPLITTER_LONGTEXT, false )
      add_obsolete_string( "vout-filter" ) /* since 2.0.0 */
+
+    add_integer( "display-late-threshold", 20, DISPLAY_LATE_THRESHOLD_TEXT,
+              DISPLAY_LATE_THRESHOLD_LONGTEXT, true )
  #if 0
      add_string( "pixel-ratio", "1", PIXEL_RATIO_TEXT, PIXEL_RATIO_TEXT )
  #endif
diff --git a/src/video_output/video_output.c 
b/src/video_output/video_output.c
index 40701b7..c82ebb3 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -63,11 +63,6 @@ static void VoutDestructor(vlc_object_t *);
   */
  #define VOUT_REDISPLAY_DELAY (INT64_C(80000))

-/**
- * Late pictures having a delay higher than this value are thrashed.
- */
-#define VOUT_DISPLAY_LATE_THRESHOLD (INT64_C(20000))
-
  /* Better be in advance when awakening than late... */
  #define VOUT_MWAIT_TOLERANCE (INT64_C(4000))

@@ -159,6 +154,9 @@ static vout_thread_t *VoutCreate(vlc_object_t *object,
      /* */
      vout_InitInterlacingSupport(vout, vout->p->displayed.is_interlaced);

+    vout->p->display_late_threshold = var_InheritInteger(vout, 
"display-late-threshold") * 1000;
+
+
      /* Window */
      if (vout->p->splitter_name == NULL) {
          vout_window_cfg_t wcfg = {
@@ -786,7 +784,7 @@ static int ThreadDisplayPreparePicture(vout_thread_t 
*vout, bool reuse, bool fra
                  if (is_late_dropped && !decoded->b_force) {
                      const mtime_t predicted = mdate() + 0; /* TODO 
improve */
                      const mtime_t late = predicted - decoded->date;
-                    if (late > VOUT_DISPLAY_LATE_THRESHOLD) {
+                    if (late > vout->p->display_late_threshold) {
                          msg_Warn(vout, "picture is too late to be 
displayed (missing %"PRId64" ms)", late/1000);
                          picture_Release(decoded);
vout_statistic_AddLost(&vout->p->statistic, 1);
diff --git a/src/video_output/vout_internal.h 
b/src/video_output/vout_internal.h
index 3b01567..5b6e792 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -112,6 +112,7 @@ struct vout_thread_sys_t

      /* */
      bool            is_late_dropped;
+    long            display_late_threshold; /* The amount if time in us 
that a picture can be late and still displayed */

      /* Video filter2 chain */
      struct {


----------------------------------------------------------------------------

David R Robison

*Principal Systems Engineer*

+1 757 546 3401 (o)

+1 757 286 0022 (m)

david.robison at openroadsconsulting.com 
<mailto:david.robison at openroadsconsulting.com>

www.openroadsconsulting.com

----------------------------------------------------------------------------

Open Roads Consulting

A Q-Free Company

103 Watson Rd. Chesapeake VA 23320

On 3/27/2015 2:27 PM, Rémi Denis-Courmont wrote:
> Le jeudi 26 mars 2015, 14:22:16 David R. Robison a écrit :
>> Sorry, I muffed the git send-mail. This is what I intended to send...
>>
>> When playing live video, sometimes the arriving packets exceed the 20ms
>> limit for displaying late pictures. I'm proposing a change to allow this
>> value to be set on the command line.
>>
>>
>>
>>   From 9ce5a84754b992b8a61b93f79c63baec6c4867eb Mon Sep 17 00:00:00 2001
>> From: David R Robison <david.robison at openroadsconsulting.com>
>> Date: Thu, 26 Mar 2015 11:13:33 -0700
>> Subject: [PATCH] Let the threshold for discarding late displays be specified
>> on the command line
>>
>> ---
>>    src/libvlc-module.c             | 7 +++++++
>>    src/video_output/video_output.c | 8 ++------
>>    2 files changed, 9 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/libvlc-module.c b/src/libvlc-module.c
>> index 46180f5..7293a6d 100644
>> --- a/src/libvlc-module.c
>> +++ b/src/libvlc-module.c
>> @@ -482,6 +482,10 @@ static const char *const ppsz_pos_descriptions[] =
>>    #define MOUSE_EVENTS_LONGTEXT N_( \
>>        "This enables handling of mouse clicks on the video." )
>>
>> +#define DISPLAY_LATE_THRESHOLD_TEXT N_("Display late threshold")
>> +#define DISPLAY_LATE_THRESHOLD_LONGTEXT N_( \
>> +    "VOUT Display late threshold in ms." )
>> +
>>   
>> /**************************************************************************
>> *** * Input
>> ****************************************************************************
>> / @@ -1605,6 +1609,9 @@ vlc_module_begin ()
>>        add_module_list( "video-splitter", "video splitter", NULL,
>>                         VIDEO_SPLITTER_TEXT, VIDEO_SPLITTER_LONGTEXT, false )
>> add_obsolete_string( "vout-filter" ) /* since 2.0.0 */
>> +
>> +    add_integer( "display-late-threshold", 20, DISPLAY_LATE_THRESHOLD_TEXT,
>> +              DISPLAY_LATE_THRESHOLD_LONGTEXT, true )
>>    #if 0
>>        add_string( "pixel-ratio", "1", PIXEL_RATIO_TEXT, PIXEL_RATIO_TEXT )
>>    #endif
>> diff --git a/src/video_output/video_output.c
>> b/src/video_output/video_output.c
>> index 40701b7..3374154 100644
>> --- a/src/video_output/video_output.c
>> +++ b/src/video_output/video_output.c
>> @@ -63,11 +63,6 @@ static void VoutDestructor(vlc_object_t *);
>>     */
>>    #define VOUT_REDISPLAY_DELAY (INT64_C(80000))
>>
>> -/**
>> - * Late pictures having a delay higher than this value are thrashed.
>> - */
>> -#define VOUT_DISPLAY_LATE_THRESHOLD (INT64_C(20000))
>> -
>>    /* Better be in advance when awakening than late... */
>>    #define VOUT_MWAIT_TOLERANCE (INT64_C(4000))
>>
>> @@ -786,7 +781,8 @@ static int ThreadDisplayPreparePicture(vout_thread_t
>> *vout, bool reuse, bool fra
>>                    if (is_late_dropped && !decoded->b_force) {
>>                        const mtime_t predicted = mdate() + 0; /* TODO
>> improve */
>>                        const mtime_t late = predicted - decoded->date;
>> -                    if (late > VOUT_DISPLAY_LATE_THRESHOLD) {
>> +                    long display_late = var_InheritInteger(vout,
>> "display-late-threshold") * 1000;
> Contending for the vout variable lock in a time critical code path is probably
> not a good idea.
>
>> +                    if (late > display_late) {
>>                            msg_Warn(vout, "picture is too late to be
>> displayed (missing %"PRId64" ms)", late/1000);
>>                            picture_Release(decoded);
>> vout_statistic_AddLost(&vout->p->statistic, 1);
>>
>>> When playing live video, sometimes the arriving packets exceed the 20ms
>>> limit for displaying late pictures. I'm proposing a change to allow this
>>> value to be set on the command line.
>>>
>>>
>>>
>>> This email communication (including any attachments) may contain
>>> confidential and/or privileged material intended solely for the
>>> individual or entity to which it is addressed. If you are not the
>>> intended recipient, please delete this email immediately.
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>> This email communication (including any attachments) may contain
>> confidential and/or privileged material intended solely for the individual
>> or entity to which it is addressed. If you are not the intended recipient,
>> please delete this email immediately.



This email communication (including any attachments) may contain confidential and/or privileged material intended solely for the individual or entity to which it is addressed.
If you are not the intended recipient, please delete this email immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150330/0ff22f01/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: orci-qfree.png
Type: image/png
Size: 8284 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150330/0ff22f01/attachment.png>


More information about the vlc-devel mailing list