guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roman (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (GUACAMOLE-110) Guacenc framerate rounding results in incorrect video length
Date Thu, 29 Sep 2016 15:30:22 GMT

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

Roman 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:

@@ -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;
 
 }

  was:
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:
> @@ -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;
>  
>  }



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

Mime
View raw message