RESOLVED FIXED 191599
[GStreamer][MediaStream] Handle track addition and removal
https://bugs.webkit.org/show_bug.cgi?id=191599
Summary [GStreamer][MediaStream] Handle track addition and removal
Thibault Saunier
Reported 2018-11-13 13:32:55 PST
[GStreamer][MediaStream] Handle track addition and removal
Attachments
Patch (15.71 KB, patch)
2018-11-13 13:42 PST, Thibault Saunier
no flags
Patch (16.61 KB, patch)
2018-11-15 05:29 PST, Thibault Saunier
no flags
Patch (17.02 KB, patch)
2018-11-16 01:57 PST, Thibault Saunier
no flags
Patch for landing (17.00 KB, patch)
2018-11-16 05:23 PST, Thibault Saunier
no flags
Patch for landing (17.02 KB, patch)
2018-11-16 05:24 PST, Thibault Saunier
no flags
Thibault Saunier
Comment 1 2018-11-13 13:42:03 PST
Xabier Rodríguez Calvar
Comment 2 2018-11-15 00:47:52 PST
Comment on attachment 354698 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354698&action=review > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:154 > + void characteristicsChanged() final { GST_DEBUG_OBJECT(m_mediaStreamSrc.get(), "renegotiation should happen."); } Nit: is it common to have periods as GStreamer logging messages? > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:488 > +static void > +webkitMediaStreamSrcAddTrack(WebKitMediaStreamSrc* self, MediaStreamTrackPrivate* track) same line > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:498 > + if (track->type() == RealtimeMediaSource::Type::Audio) { > + webkitMediaStreamSrcSetupAppSrc(self, track, &self->audioSrc, > + &audioSrcTemplate); > + } else if (track->type() == RealtimeMediaSource::Type::Video) { > + webkitMediaStreamSrcSetupAppSrc(self, track, &self->videoSrc, > + &videoSrcTemplate); > + } else { > + GST_INFO("Unsuported track type: %d", (gint) track->type()); > } For such small lines you don't need to split in two. Besides, brackets should go away as they are one line clauses. UnsuPPorted. (gint) -> static_cast<int>(...) > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:502 > +static void > +webkitMediaStreamSrcRemoveTrackByType(WebKitMediaStreamSrc* self, RealtimeMediaSource::Type trackType) same line > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:510 > + No need for this line > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:519 > + } else { > + GST_INFO("Unsuported track type: %d", (gint) trackType); > } No need for brackets and fix the cast, please. > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:522 > +gboolean webkitMediaStreamSrcSetStream(WebKitMediaStreamSrc* self, MediaStreamPrivate* stream) This function should return bool > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:524 > + g_return_val_if_fail(WEBKIT_IS_MEDIA_STREAM_SRC(self), FALSE); I don't think this is needed here, right? Anyway, if you want to keep such a test it should be ASSERT().
Thibault Saunier
Comment 3 2018-11-15 05:29:24 PST
Xabier Rodríguez Calvar
Comment 4 2018-11-15 23:25:14 PST
Comment on attachment 354922 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354922&action=review > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:494 > + GST_INFO("Unsupported track type: %d", (gint) track->type()); Please, use static_cast here. > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:505 > This line does not make sense here. Please remove it. > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:513 > + GST_INFO("Unsupported track type: %d", (gint) trackType); static_cast, please > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:518 > + g_return_val_if_fail(WEBKIT_IS_MEDIA_STREAM_SRC(self), FALSE); I don't think this is needed here. If you still consider it needed, please turn it into an ASSERT instead of g_return_val_if_fail (which btw, should be returning false instead of FALSE now that it is a bool instead of a gboolean).
Thibault Saunier
Comment 5 2018-11-16 01:57:10 PST
Thibault Saunier
Comment 6 2018-11-16 01:57:26 PST
(In reply to Xabier Rodríguez Calvar from comment #4) > Comment on attachment 354922 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=354922&action=review > > > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:494 > > + GST_INFO("Unsupported track type: %d", (gint) track->type()); > > Please, use static_cast here. Done. > > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:505 > > > > This line does not make sense here. Please remove it. > > > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:513 > > + GST_INFO("Unsupported track type: %d", (gint) trackType); > > static_cast, please Done > > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:518 > > + g_return_val_if_fail(WEBKIT_IS_MEDIA_STREAM_SRC(self), FALSE); > > I don't think this is needed here. If you still consider it needed, please > turn it into an ASSERT instead of g_return_val_if_fail (which btw, should be > returning false instead of FALSE now that it is a bool instead of a > gboolean). Well it is external API, better safe guard it? ASSERT is not the same thing, `g_return_val_if_fail` leads to a runtime warning, not an ASSERT by default.
Xabier Rodríguez Calvar
Comment 7 2018-11-16 04:19:38 PST
Comment on attachment 355036 [details] Patch (In reply to Thibault Saunier from comment #6) > > > Source/WebCore/platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:518 > > > + g_return_val_if_fail(WEBKIT_IS_MEDIA_STREAM_SRC(self), FALSE); > > > > I don't think this is needed here. If you still consider it needed, please > > turn it into an ASSERT instead of g_return_val_if_fail (which btw, should be > > returning false instead of FALSE now that it is a bool instead of a > > gboolean). > > Well it is external API, better safe guard it? > ASSERT is not the same thing, `g_return_val_if_fail` leads to a runtime > warning, not an ASSERT by default. If it remains inside WebKit without being exposed to C or GTK APIs, then we should stick to the ASSERT.
Thibault Saunier
Comment 8 2018-11-16 05:23:10 PST
Created attachment 355047 [details] Patch for landing
Thibault Saunier
Comment 9 2018-11-16 05:24:05 PST
Created attachment 355048 [details] Patch for landing
Thibault Saunier
Comment 10 2018-11-16 05:44:05 PST
> If it remains inside WebKit without being exposed to C or GTK APIs, then we should stick to the ASSERT. You are right, just id that. Sorry for the noise
WebKit Commit Bot
Comment 11 2018-11-16 06:01:27 PST
Comment on attachment 355048 [details] Patch for landing Clearing flags on attachment: 355048 Committed r238276: <https://trac.webkit.org/changeset/238276>
WebKit Commit Bot
Comment 12 2018-11-16 06:01:28 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 13 2018-11-16 06:03:46 PST
Note You need to log in before you can comment on or make changes to this bug.