You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by "Michael Jumper (JIRA)" <ji...@apache.org> on 2016/10/03 02:42:21 UTC

[jira] [Updated] (GUACAMOLE-110) Guacenc framerate rounding results in incorrect video length

     [ https://issues.apache.org/jira/browse/GUACAMOLE-110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Jumper updated GUACAMOLE-110:
-------------------------------------
    Description: 
guacenc produces video shorter than the actual length (based on the timestamps in the input file). In one of my tests: 16s vs 22s. This is caused by timestamp deltas being rounded to frames in guacenc_video_advance_timeline.


Sample patch:

{code:none}
@@ -209,6 +209,8 @@
 int guacenc_video_advance_timeline(guacenc_video* video,
         guac_timestamp timestamp) {
 
+    guac_timestamp next_timestamp = timestamp;
+
     /* Flush frames as necessary if previously updated */
     if (video->last_timestamp != 0) {
 
@@ -219,6 +221,10 @@
         /* Keep previous timestamp if insufficient time has elapsed */
         if (elapsed == 0)
             return 0;
+
+        /* Use frame time, not the current timestamp for last_timestamp */
+        next_timestamp = video->last_timestamp
+                       + elapsed * 1000 / GUACENC_VIDEO_FRAMERATE;
 
         /* Flush frames to bring timeline in sync, duplicating if necessary */
         do {
@@ -228,7 +234,7 @@
     }
 
     /* Update timestamp */
-    video->last_timestamp = timestamp;
+    video->last_timestamp = next_timestamp;
     return 0;
 
 }
{code}

  was:
guacenc produces video shorter than the actual length (based on the timestamps in the input file). In one of my tests: 16s vs 22s. This is caused by timestamp deltas being rounded to frames in guacenc_video_advance_timeline.


Sample patch:

@@ -209,6 +209,8 @@
 int guacenc_video_advance_timeline(guacenc_video* video,
         guac_timestamp timestamp) {
 
+    guac_timestamp next_timestamp = timestamp;
+
     /* Flush frames as necessary if previously updated */
     if (video->last_timestamp != 0) {
 
@@ -219,6 +221,10 @@
         /* Keep previous timestamp if insufficient time has elapsed */
         if (elapsed == 0)
             return 0;
+
+        /* Use frame time, not the current timestamp for last_timestamp */
+        next_timestamp = video->last_timestamp
+                       + elapsed * 1000 / GUACENC_VIDEO_FRAMERATE;
 
         /* Flush frames to bring timeline in sync, duplicating if necessary */
         do {
@@ -228,7 +234,7 @@
     }
 
     /* Update timestamp */
-    video->last_timestamp = timestamp;
+    video->last_timestamp = next_timestamp;
     return 0;
 
 }


> Guacenc framerate rounding results in incorrect video length
> ------------------------------------------------------------
>
>                 Key: GUACAMOLE-110
>                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-110
>             Project: Guacamole
>          Issue Type: Bug
>          Components: guacamole-server
>            Reporter: Roman
>
> guacenc produces video shorter than the actual length (based on the timestamps in the input file). In one of my tests: 16s vs 22s. This is caused by timestamp deltas being rounded to frames in guacenc_video_advance_timeline.
> Sample patch:
> {code:none}
> @@ -209,6 +209,8 @@
>  int guacenc_video_advance_timeline(guacenc_video* video,
>          guac_timestamp timestamp) {
>  
> +    guac_timestamp next_timestamp = timestamp;
> +
>      /* Flush frames as necessary if previously updated */
>      if (video->last_timestamp != 0) {
>  
> @@ -219,6 +221,10 @@
>          /* Keep previous timestamp if insufficient time has elapsed */
>          if (elapsed == 0)
>              return 0;
> +
> +        /* Use frame time, not the current timestamp for last_timestamp */
> +        next_timestamp = video->last_timestamp
> +                       + elapsed * 1000 / GUACENC_VIDEO_FRAMERATE;
>  
>          /* Flush frames to bring timeline in sync, duplicating if necessary */
>          do {
> @@ -228,7 +234,7 @@
>      }
>  
>      /* Update timestamp */
> -    video->last_timestamp = timestamp;
> +    video->last_timestamp = next_timestamp;
>      return 0;
>  
>  }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)