summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Sarakeev <sarakusha@gmail.com>2014-09-02 11:13:44 +0400
committerSebastian Dröge <sebastian@centricular.com>2014-09-04 12:52:33 +0300
commit7318f0e8165c0ee1859429af7927d51e024aff7f (patch)
tree6af78f7bfccb3c19ef7e7ff936d154b1ba48887c
parent729c914ca3d396c18ea52fbb9c1070dfbf43ec51 (diff)
videomixer: Fix synchronization if dynamically changing the FPS
https://bugzilla.gnome.org/show_bug.cgi?id=735859
-rw-r--r--gst/videomixer/videomixer2.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c
index 9bcbc75ef..180c24afb 100644
--- a/gst/videomixer/videomixer2.c
+++ b/gst/videomixer/videomixer2.c
@@ -401,6 +401,20 @@ gst_videomixer2_update_converters (GstVideoMixer2 * mix)
best_colorimetry = gst_video_colorimetry_to_string (&(best_info.colorimetry));
best_chroma = gst_video_chroma_to_string (best_info.chroma_site);
+
+ if (GST_VIDEO_INFO_FPS_N (&mix->info) != GST_VIDEO_INFO_FPS_N (&best_info) ||
+ GST_VIDEO_INFO_FPS_D (&mix->info) != GST_VIDEO_INFO_FPS_D (&best_info)) {
+ if (mix->segment.position != -1) {
+ mix->ts_offset = mix->segment.position - mix->segment.start;
+ mix->nframes = 0;
+ } else {
+ mix->ts_offset += gst_util_uint64_scale_round (mix->nframes,
+ GST_SECOND * GST_VIDEO_INFO_FPS_D (&mix->info),
+ GST_VIDEO_INFO_FPS_N (&mix->info));
+ mix->nframes = 0;
+ }
+ }
+
mix->info = best_info;
GST_DEBUG_OBJECT (mix,