Changeset 242035 in webkit


Ignore:
Timestamp:
Feb 25, 2019 2:15:31 AM (5 years ago)
Author:
cturner@igalia.com
Message:

[EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
https://bugs.webkit.org/show_bug.cgi?id=194992

Reviewed by Xabier Rodriguez-Calvar.

Refactoring, no new tests.

  • platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:

(transformCaps): Simplify the code a little. The idea to use this
utility function came from a review upstream here:
https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242034 r242035  
     12019-02-25  Charlie Turner  <cturner@igalia.com>
     2
     3        [EME][GStreamer] Replace caps field loop with gst_structure_remove_fields
     4        https://bugs.webkit.org/show_bug.cgi?id=194992
     5
     6        Reviewed by Xabier Rodriguez-Calvar.
     7
     8        Refactoring, no new tests.
     9
     10        * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
     11        (transformCaps): Simplify the code a little. The idea to use this
     12        utility function came from a review upstream here:
     13        https://gitlab.freedesktop.org/gstreamer/gst-devtools/merge_requests/67
     14
    1152019-02-25  Alicia Boya García  <aboya@igalia.com>
    216
  • trunk/Source/WebCore/platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp

    r240148 r242035  
    128128
    129129            // Filter out the DRM related fields from the down-stream caps.
    130             for (int j = 0; j < gst_structure_n_fields(incomingStructure); ++j) {
    131                 const gchar* fieldName = gst_structure_nth_field_name(incomingStructure, j);
    132 
    133                 if (g_str_has_prefix(fieldName, "protection-system")
    134                     || g_str_has_prefix(fieldName, "original-media-type")
    135                     || g_str_has_prefix(fieldName, "encryption-algorithm")
    136                     || g_str_has_prefix(fieldName, "encoding-scope")
    137                     || g_str_has_prefix(fieldName, "cipher-mode"))
    138                     gst_structure_remove_field(outgoingStructure.get(), fieldName);
    139             }
     130            gst_structure_remove_fields(outgoingStructure.get(), "protection-system", "original-media-type", "encryption-algorithm", "encoding-scope", "cipher-mode", nullptr);
    140131        } else {
    141132            outgoingStructure = GUniquePtr<GstStructure>(gst_structure_copy(incomingStructure));
     
    143134            // because they are not relevant to the input caps of this element and
    144135            // can cause caps negotiation failures with adaptive bitrate streams.
    145             for (int index = gst_structure_n_fields(outgoingStructure.get()) - 1; index >= 0; --index) {
    146                 const gchar* fieldName = gst_structure_nth_field_name(outgoingStructure.get(), index);
    147                 GST_TRACE("Check field \"%s\" for removal", fieldName);
    148 
    149                 if (!g_strcmp0(fieldName, "base-profile")
    150                     || !g_strcmp0(fieldName, "codec_data")
    151                     || !g_strcmp0(fieldName, "height")
    152                     || !g_strcmp0(fieldName, "framerate")
    153                     || !g_strcmp0(fieldName, "level")
    154                     || !g_strcmp0(fieldName, "pixel-aspect-ratio")
    155                     || !g_strcmp0(fieldName, "profile")
    156                     || !g_strcmp0(fieldName, "rate")
    157                     || !g_strcmp0(fieldName, "width")) {
    158                     gst_structure_remove_field(outgoingStructure.get(), fieldName);
    159                     GST_TRACE("Removing field %s", fieldName);
    160                 }
    161             }
     136            gst_structure_remove_fields(outgoingStructure.get(), "base-profile", "codec_data", "height", "framerate", "level", "pixel-aspect-ratio", "profile", "rate", "width", nullptr);
    162137
    163138            gst_structure_set(outgoingStructure.get(), "protection-system", G_TYPE_STRING, klass->protectionSystemId,
Note: See TracChangeset for help on using the changeset viewer.