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 791479 - msdkenc: Support force-keyunit events
msdkenc: Support force-keyunit events
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
unspecified
Other Linux
: Normal enhancement
: 1.13.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 789886
 
 
Reported: 2017-12-11 14:14 UTC by Sebastian Dröge (slomo)
Modified: 2018-02-22 20:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
msdk: enc: support force key unit event (1.95 KB, patch)
2018-02-21 01:13 UTC, sreerenj
none Details | Review
msdkenc: remove unnecessary memset and field clearing (939 bytes, patch)
2018-02-21 21:55 UTC, sreerenj
none Details | Review
msdk: enc: support force key unit event (1.96 KB, patch)
2018-02-22 20:32 UTC, sreerenj
committed Details | Review
msdkenc: remove unnecessary memset and field clearing (943 bytes, patch)
2018-02-22 20:33 UTC, sreerenj
committed Details | Review

Description Sebastian Dröge (slomo) 2017-12-11 14:14:59 UTC
See summary. It just has to checked on the input if GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME(frame) and request a keyframe for that very input frame then.
Comment 1 sreerenj 2017-12-14 01:52:06 UTC
I'm currently adding encoder tuning options which include the FORCE_KEYFRAME too.
But if you already have the patch, just push it :)
Comment 2 Sebastian Dröge (slomo) 2018-01-17 07:53:04 UTC
Go ahead if it's simple to add to whatever other changes you already have :) Otherwise I'll get to it at some point
Comment 3 sreerenj 2018-02-21 01:13:03 UTC
Created attachment 368685 [details] [review]
msdk: enc: support force key unit event
Comment 4 Tim-Philipp Müller 2018-02-21 08:31:40 UTC
Comment on attachment 368685 [details] [review]
msdk: enc: support force key unit event

>+    /* Force key-frame if needed */
>+    if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (input_frame))
>+      thiz->enc_cntrl.FrameType =
>+          MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF;
>+    else
>+      thiz->enc_cntrl.FrameType = MFX_FRAMETYPE_UNKNOWN;

Not that I know how this API works, but shouldn't this be just

 thiz->enc_cntrl.FrameType = MFX_FRAMETYPE_IDR;

?
Comment 5 Víctor Manuel Jáquez Leal 2018-02-21 15:35:34 UTC
Review of attachment 368685 [details] [review]:

::: sys/msdk/gstmsdkenc.c
@@ +1393,3 @@
   memset (&thiz->option2, 0, sizeof (thiz->option2));
   memset (&thiz->option2, 0, sizeof (thiz->option3));
+  memset (&thiz->enc_cntrl, 0, sizeof (thiz->enc_cntrl));

These memset and the FALSE assignation doesn't make sense, since the gobject allocation already clears to zero the object structure.
Comment 6 sreerenj 2018-02-21 20:17:04 UTC
(In reply to Tim-Philipp Müller from comment #4)
> Comment on attachment 368685 [details] [review] [review]
> msdk: enc: support force key unit event
> 
> >+    /* Force key-frame if needed */
> >+    if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (input_frame))
> >+      thiz->enc_cntrl.FrameType =
> >+          MFX_FRAMETYPE_I | MFX_FRAMETYPE_IDR | MFX_FRAMETYPE_REF;
> >+    else
> >+      thiz->enc_cntrl.FrameType = MFX_FRAMETYPE_UNKNOWN;
> 
> Not that I know how this API works, but shouldn't this be just
> 
>  thiz->enc_cntrl.FrameType = MFX_FRAMETYPE_IDR;
> 
> ?

Ideally yes, but the above code is what I have seen in msdk sample application.
If a particular use case is already implemented in msdk sample application, I prefer to stick with same code since they (msdk developers) might have assumptions based on it :)
I have seen cases like that for eg:https://github.com/Intel-Media-SDK/samples/issues/13
Comment 7 sreerenj 2018-02-21 21:54:28 UTC
(In reply to Víctor Manuel Jáquez Leal from comment #5)
> Review of attachment 368685 [details] [review] [review]:
> 
> ::: sys/msdk/gstmsdkenc.c
> @@ +1393,3 @@
>    memset (&thiz->option2, 0, sizeof (thiz->option2));
>    memset (&thiz->option2, 0, sizeof (thiz->option3));
> +  memset (&thiz->enc_cntrl, 0, sizeof (thiz->enc_cntrl));
> 
> These memset and the FALSE assignation doesn't make sense, since the gobject
> allocation already clears to zero the object structure.

Thanks. I will update with another patch since those fields were introduced by a different patch.
Comment 8 sreerenj 2018-02-21 21:55:10 UTC
Created attachment 368732 [details] [review]
msdkenc: remove unnecessary memset  and field clearing
Comment 9 sreerenj 2018-02-22 20:32:34 UTC
Created attachment 368796 [details] [review]
msdk: enc: support force key unit event
Comment 10 sreerenj 2018-02-22 20:33:09 UTC
Created attachment 368797 [details] [review]
msdkenc: remove unnecessary memset  and field clearing
Comment 11 sreerenj 2018-02-22 20:33:32 UTC
Review of attachment 368796 [details] [review]:

Pushed as 3cc61f98b1f061cde714a22dab0d211de740aea6
Comment 12 sreerenj 2018-02-22 20:33:56 UTC
Review of attachment 368797 [details] [review]:

Pushed as 1c81bf4bdc67b518d6b3bbc22398c17fe8ced1da