Bug 190674

Summary: [GStreamer][WebRTC] Add webrtcencoder bin to cleanup and refactor the way we set encoders
Product: WebKit Reporter: Thibault Saunier <tsaunier>
Component: New BugsAssignee: Thibault Saunier <tsaunier>
Status: RESOLVED FIXED    
Severity: Normal CC: alex, calvaris, commit-queue, pnormand, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 187064, 190676    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch for landing none

Thibault Saunier
Reported 2018-10-17 11:56:50 PDT
[GStreamer][WebRTC] Add webrtcencoder bin to cleanup and refactor the way we set encoders
Attachments
Patch (28.42 KB, patch)
2018-10-17 12:00 PDT, Thibault Saunier
no flags
Patch (28.49 KB, patch)
2018-10-31 04:20 PDT, Thibault Saunier
no flags
Patch (28.59 KB, patch)
2018-11-05 06:16 PST, Thibault Saunier
no flags
Patch for landing (28.67 KB, patch)
2018-11-05 06:32 PST, Thibault Saunier
no flags
Thibault Saunier
Comment 1 2018-10-17 12:00:18 PDT
Xabier Rodríguez Calvar
Comment 2 2018-10-18 00:53:38 PDT
Comment on attachment 352603 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352603&action=review > Source/WebCore/ChangeLog:12 > + The added files follow GStreamer coding style as we aim at upstreaming the element > + in the future. In the future is quite vague. I won't block this because of this issue but I really think that coding style can change during the upstreaming process and currently we should respect WebKit's. > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:52 > + const char *name; > + const char *parser_name; This is inconsistent. Either use char or gchar. > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:101 > + static void gst_webrtc_video_encoder_finalize (GObject * object) Indentation > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:140 > + if (priv->encoder) > + encoders[priv->encoderId].setBitrate (G_OBJECT (priv->encoder), > + encoders[priv->encoderId].bitrate_propname, priv->bitrate); Please correct me if I am wrong, but I think GStreamer would recommend { } enclosing what is running after evaluation the if clause.
Philippe Normand
Comment 3 2018-10-18 02:41:59 PDT
Comment on attachment 352603 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=352603&action=review > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:185 > + GstPad *tmppad2 = gst_element_get_static_pad (priv->capsfilter, "sink"); This pad leaks, I think. > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:230 > + GstPluginFeature *feature = > + gst_registry_lookup_feature (gst_registry_get (), name); Leak? :)
Thibault Saunier
Comment 4 2018-10-31 04:20:20 PDT
Thibault Saunier
Comment 5 2018-10-31 04:20:40 PDT
(In reply to Xabier Rodríguez Calvar from comment #2) > Comment on attachment 352603 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=352603&action=review > > > Source/WebCore/ChangeLog:12 > > + The added files follow GStreamer coding style as we aim at upstreaming the element > > + in the future. > > In the future is quite vague. I won't block this because of this issue but I > really think that coding style can change during the upstreaming process and > currently we should respect WebKit's. We discussed that last week, and I believe you ended up "agreeing" we should do it that way. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:52 > > + const char *name; > > + const char *parser_name; > > This is inconsistent. Either use char or gchar. Done, using GLib variants all around now. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:101 > > + static void gst_webrtc_video_encoder_finalize (GObject * object) > > Indentation Fixed. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:140 > > + if (priv->encoder) > > + encoders[priv->encoderId].setBitrate (G_OBJECT (priv->encoder), > > + encoders[priv->encoderId].bitrate_propname, priv->bitrate); > > Please correct me if I am wrong, but I think GStreamer would recommend { } > enclosing what is running after evaluation the if clause. Fixed, though it is accepted in GStreamer. (In reply to Philippe Normand from comment #3) > Comment on attachment 352603 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=352603&action=review > > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:185 > > + GstPad *tmppad2 = gst_element_get_static_pad (priv->capsfilter, "sink"); > > This pad leaks, I think. Fixed. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:230 > > + GstPluginFeature *feature = > > + gst_registry_lookup_feature (gst_registry_get (), name); > > Leak? :) Fixed.
Philippe Normand
Comment 6 2018-10-31 06:19:34 PDT
Comment on attachment 353486 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=353486&action=review > Source/WebCore/platform/GStreamer.cmake:38 > platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp > + platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp > platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp It's a minor detail but I think those files should move to platform/mediastream/gstreamer/ at some point. > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:61 > + ENCODER_NONE, Might be good to explicitly assign to 0? > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:77 > + ENCODER_LAST, > +} EncoderId; > + > +EncoderDefinition encoders[ENCODER_LAST] = { > + FALSE, > + NULL, > + NULL, > + NULL, > + NULL, > + NULL, > + NULL, > + NULL, > +}; So ENCODER_LAST is 4 but encoders's array is bigger. How is this supposed to work? :) > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:97 > +G_DEFINE_TYPE_WITH_PRIVATE (GstWebrtcVideoEncoder, gst_webrtc_video_encoder, > + GST_TYPE_BIN) > + enum > + { > + PROP_0, > + PROP_FORMAT, > + PROP_ENCODER, > + PROP_BITRATE, > + N_PROPS > + }; The indentation is odd here > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:101 > + static void gst_webrtc_video_encoder_finalize (GObject * object) Useless whitespace here ;) > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:153 > + for (i = 1; i < ENCODER_LAST; i++) { So here you start at 1 because the first item is always FALSE anyway, right? > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:282 > + g_object_set (encoder, prop_name, bitrate * 1024, NULL); Use KBIT_TO_BIT here? Otherwise this macro is unused.
Thibault Saunier
Comment 7 2018-11-05 06:16:21 PST
Thibault Saunier
Comment 8 2018-11-05 06:16:30 PST
(In reply to Philippe Normand from comment #6) > Comment on attachment 353486 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=353486&action=review > > > Source/WebCore/platform/GStreamer.cmake:38 > > platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp > > + platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp > > platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp > > It's a minor detail but I think those files should move to > platform/mediastream/gstreamer/ at some point. > > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:61 > > + ENCODER_NONE, > > Might be good to explicitly assign to 0? Done. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:77 > > + ENCODER_LAST, > > +} EncoderId; > > + > > +EncoderDefinition encoders[ENCODER_LAST] = { > > + FALSE, > > + NULL, > > + NULL, > > + NULL, > > + NULL, > > + NULL, > > + NULL, > > + NULL, > > +}; > > So ENCODER_LAST is 4 but encoders's array is bigger. How is this supposed to > work? :) Those are setting the content of the `EncoderDefinition` structure, not the whole array itself. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:97 > > +G_DEFINE_TYPE_WITH_PRIVATE (GstWebrtcVideoEncoder, gst_webrtc_video_encoder, > > + GST_TYPE_BIN) > > + enum > > + { > > + PROP_0, > > + PROP_FORMAT, > > + PROP_ENCODER, > > + PROP_BITRATE, > > + N_PROPS > > + }; > > The indentation is odd here `gst-indent`' doing :-) - added necessary `INDENT-OFF/ON`. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:101 > > + static void gst_webrtc_video_encoder_finalize (GObject * object) > > Useless whitespace here ;) Same. > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:153 > > + for (i = 1; i < ENCODER_LAST; i++) { > > So here you start at 1 because the first item is always FALSE anyway, right? Right 0 is the NONE encoder :-) > > Source/WebCore/platform/mediastream/libwebrtc/GStreamerVideoEncoder.cpp:282 > > + g_object_set (encoder, prop_name, bitrate * 1024, NULL); > > Use KBIT_TO_BIT here? Otherwise this macro is unused.
WebKit Commit Bot
Comment 9 2018-11-05 06:27:29 PST
Comment on attachment 353856 [details] Patch Rejecting attachment 353856 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'validate-changelog', '--check-oops', '--non-interactive', 353856, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit /Volumes/Data/EWS/WebKit/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive). Full output: https://webkit-queues.webkit.org/results/9864724
Thibault Saunier
Comment 10 2018-11-05 06:32:09 PST
Created attachment 353858 [details] Patch for landing
WebKit Commit Bot
Comment 11 2018-11-05 07:10:03 PST
Comment on attachment 353858 [details] Patch for landing Clearing flags on attachment: 353858 Committed r237801: <https://trac.webkit.org/changeset/237801>
WebKit Commit Bot
Comment 12 2018-11-05 07:10:04 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13 2018-11-05 07:11:21 PST
Note You need to log in before you can comment on or make changes to this bug.