RESOLVED FIXED Bug 176445
[GStreamer] Implement MediaPlayerPrivateGStreamerMSE::attempToDecryptWithInstance()
https://bugs.webkit.org/show_bug.cgi?id=176445
Summary [GStreamer] Implement MediaPlayerPrivateGStreamerMSE::attempToDecryptWithInst...
Zan Dobersek
Reported 2017-09-06 02:49:16 PDT
[GStreamer] Implement MediaPlayerPrivateGStreamerMSE::attempToDecryptWithInstance()
Attachments
Patch (6.31 KB, patch)
2017-09-06 02:56 PDT, Zan Dobersek
no flags
Patch (6.23 KB, patch)
2017-09-06 03:23 PDT, Zan Dobersek
no flags
Patch (5.89 KB, patch)
2017-09-06 03:38 PDT, Zan Dobersek
no flags
Patch for landing (5.83 KB, patch)
2017-09-06 06:32 PDT, Zan Dobersek
no flags
Zan Dobersek
Comment 1 2017-09-06 02:56:11 PDT
Build Bot
Comment 2 2017-09-06 02:59:12 PDT
Attachment 319997 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:952: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Charlie Turner
Comment 3 2017-09-06 03:11:58 PDT
Comment on attachment 319997 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=319997&action=review > Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:944 > + if (keys.isEmpty()) Same check as above? > Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:952 > + { Why are the extra scopes used in the loop, is there some problem with have G variables as autos outside the loop?
Zan Dobersek
Comment 4 2017-09-06 03:22:52 PDT
Comment on attachment 319997 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=319997&action=review >> Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:952 >> + { > > Why are the extra scopes used in the loop, is there some problem with have G variables as autos outside the loop? It's used for clarity, and to not accidentally access resources across the two GValue constructions.
Zan Dobersek
Comment 5 2017-09-06 03:23:29 PDT
Build Bot
Comment 6 2017-09-06 03:26:28 PDT
Attachment 319998 [details] did not pass style-queue: ERROR: Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:948: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zan Dobersek
Comment 7 2017-09-06 03:38:50 PDT
Created attachment 320000 [details] Patch Now uses a functor to group the common code for GStreamer value list appends.
Xabier Rodríguez Calvar
Comment 8 2017-09-06 05:23:35 PDT
Comment on attachment 320000 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=320000&action=review > Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:950 > + GRefPtr<GstBuffer> gstBuffer(gst_buffer_new_wrapped( You can use a single line > Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:954 > + g_value_set_boxed(bufferValue, gstBuffer.get()); Use gst_value_take_buffer or adopt the reference and use set. > Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:968 > + GUniquePtr<GstStructure> structure(gst_structure_new_empty("drm-cipher-clearkey")); > + gst_structure_set_value(structure.get(), "key-ids", &keyIDList); > + gst_structure_set_value(structure.get(), "key-values", &keyValueList); > + > + for (auto it : m_appendPipelinesMap) > + it.value->dispatchDecryptionStructure(GUniquePtr<GstStructure>(gst_structure_copy(structure.get()))); I have comments about this code: * Shouldn't we WTFMove the GUniquePtr as it the method takes a && ? * Considering that the copy is not shallow and can mean some memory copies, I think it would be interesting to unroll the loop once and copy the the structure in all cases but one, where we'd move. > Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:89 > + void attemptToDecryptWithInstance(const CDMInstance&) override; You can go with final here.
Xabier Rodríguez Calvar
Comment 9 2017-09-06 05:24:39 PDT
Comment on attachment 320000 [details] Patch Please, have a look at the comments before landing.
Zan Dobersek
Comment 10 2017-09-06 06:31:20 PDT
Comment on attachment 320000 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=320000&action=review >> Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:954 >> + g_value_set_boxed(bufferValue, gstBuffer.get()); > > Use gst_value_take_buffer or adopt the reference and use set. I'll just inline the gst_buffer_new_wrapped() in the gst_value_take_buffer then. >> Source/WebCore/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:968 >> + it.value->dispatchDecryptionStructure(GUniquePtr<GstStructure>(gst_structure_copy(structure.get()))); > > I have comments about this code: > * Shouldn't we WTFMove the GUniquePtr as it the method takes a && ? > * Considering that the copy is not shallow and can mean some memory copies, I think it would be interesting to unroll the loop once and copy the the structure in all cases but one, where we'd move. * No WTFMove is necessary, GUniquePtr<> as constructed here is an rvalue that binds fine to the GUniquePtr<>&& type used by the callee. * This isn't worth the complexity. The copied data isn't large in size, and this altogether is not a frequent operation.
Zan Dobersek
Comment 11 2017-09-06 06:32:56 PDT
Created attachment 320015 [details] Patch for landing
Zan Dobersek
Comment 12 2017-09-06 22:58:34 PDT
Comment on attachment 320015 [details] Patch for landing Clearing flags on attachment: 320015 Committed r221718: <http://trac.webkit.org/changeset/221718>
Zan Dobersek
Comment 13 2017-09-06 22:58:38 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14 2017-09-27 12:35:31 PDT
Note You need to log in before you can comment on or make changes to this bug.