After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 706885 - videoencoder: Fix forwarding of GstForceKeyUnit events
videoencoder: Fix forwarding of GstForceKeyUnit events
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
git master
Other Linux
: Normal normal
: 1.1.4
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-08-27 13:05 UTC by Andoni Morales
Modified: 2013-08-27 13:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-videoencoder-fix-forwarding-of-GstForceKeyUnit-event.patch (1.50 KB, patch)
2013-08-27 13:05 UTC, Andoni Morales
committed Details | Review

Description Andoni Morales 2013-08-27 13:05:40 UTC
Created attachment 253242 [details] [review]
0001-videoencoder-fix-forwarding-of-GstForceKeyUnit-event.patch

The algorithm to match the output sync frame with a GstForceKeyUnit event should be using the frame_id instead of trying to match using times.

With the current code the output is as follows:
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:00.083333333
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:02.041666666
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:00.000000000, all_headers 0, count 0
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:04.000000000
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:06.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:04.000000000, all_headers 0, count 1
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:05.125000000, all_headers 0, count 2
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:08.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:06.000000000, all_headers 0, count 3
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:08.000000000, all_headers 0, count 4
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:10.166666666
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:12.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:10.166666666, all_headers 0, count 5
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:14.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:12.000000000, all_headers 0, count 6
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:14.000000000, all_headers 0, count 7
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:16.166666666


The problem comes with the second force keyframe, which has a running-time lower than 0:00:02.000000000, so the event for 0:00:04.000000000 is pushed instead. Next come a non-forced keyframe at 0:00:05.125000000 which is pushed because its running-time is bigger than 0:00:02.000000000.

Using the frame id to match the keyframe with the event get:
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:00.083333333
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:02.041666666
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:00.000000000, all_headers 0, count 0
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:04.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:01.958333333, all_headers 0, count 1
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:06.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:04.000000000, all_headers 0, count 2
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:08.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:06.000000000, all_headers 0, count 3
gst_video_encoder_chain:<x264enc0> Forcing a key unit at running time 0:00:10.000000000
gst_video_encoder_finish_frame:<x264enc0> Forced key unit: running-time 0:00:08.000000000, all_headers 0, count 4
Comment 1 Sebastian Dröge (slomo) 2013-08-27 13:11:48 UTC
commit 688505de8843db95b3bdeff4d7c09bb4755f53a2
Author: Andoni Morales Alastruey <ylatuya@gmail.com>
Date:   Tue Aug 27 15:03:54 2013 +0200

    videoencoder: fix forwarding of GstForceKeyUnit events
    
    Use the frame id to match the output forced keyframe with
    the event that forced it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706885