[webkit-reviews] review granted: [Bug 77087] [GStreamer] 0.11 video-sink : [Attachment 148244] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 18 22:34:06 PDT 2012


Martin Robinson <mrobinson at webkit.org> has granted Philippe Normand
<pnormand at igalia.com>'s request for review:
Bug 77087: [GStreamer] 0.11 video-sink
https://bugs.webkit.org/show_bug.cgi?id=77087

Attachment 148244: Patch
https://bugs.webkit.org/attachment.cgi?id=148244&action=review

------- Additional Comments from Martin Robinson <mrobinson at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=148244&action=review


This version is a lot better! I'm still a bit sad to see all of the #ifdefs
splitting everything though. :( Please fix the following things before landing.


> Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp:52
> +bool webkitGetVideoSizeAndFormatFromCaps(GstCaps* caps, WebCore::IntSize&
size, GstVideoFormat& format, int& pixelAspectRatioNumerator, int&
pixelAspectRatioDenominator, int& stride)

Please don't use the webkit prefix here.

> Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp:80
> +GstBuffer* webkitGstCreateBuffer(GstBuffer* buffer)

This should probably be called createGstBuffer.

> Source/WebCore/platform/graphics/gstreamer/GStreamerVersioning.cpp:90
> +    if (!newBuffer)
> +	   return 0;

ASSERT(newBuffer) maybe. Do you handle returning zero at the callers? If not,
this should be an assert instead of a return.

> Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h:33
> +typedef struct _GstBuffer GstBuffer;
> +typedef struct _GstCaps GstCaps;

GstVersioning.h now includes gst.h, so perhaps you can get rid of these
typedefs now?

> Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp:33
>  #include <wtf/gobject/GOwnPtr.h>

This should go before the conditional includes according to WebKit style, I
believe.

> Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp:39
> +    : m_image(0)

m_image is a RefPtr so you don't need to initialize it here.

> Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCairo.cpp:68
> +    GstVideoCropMeta* cropMeta = gst_buffer_get_video_crop_meta(buffer);
> +    if (cropMeta)
> +	   setCropRect(FloatRect(cropMeta->x, cropMeta->y, cropMeta->width,
cropMeta->height));

This can simply be:
if (GstVideoCropMeta* cropMeta = gst_buffer_get_video_crop_meta(buffer))
    setCropRect(FloatRect(cropMeta->x, cropMeta->y, cropMeta->width,
cropMeta->height));

>
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:502
> +    int pixelAspectRatioNumerator, pixelAspectRatioDenominator, stride;

It'd be better to move these down to where you first use them.

>
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:505
>      int displayWidth, displayHeight, displayAspectRatioGCD;
> -    int originalWidth = 0, originalHeight = 0;
> +    IntSize originalSize;
> +    GstVideoFormat format;

The same for all of these variables really.

> Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp:349
> +    WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(baseSink);

Might as well move sink down to where it's first used.

> Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp:403
> +#ifdef GST_API_VERSION_1
> +    gst_element_class_set_metadata(elementClass,
> +#else
>      gst_element_class_set_details_simple(elementClass,
> +#endif
>	       "WebKit video sink",
>	       "Sink/Video", "Sends video data from a GStreamer pipeline to a
Cairo surface",
>	       "Alp Toker <alp at atoker.com>");

It'd be better to wrap this into a helper method like:

void setGstElementClassMetadata(GstElementClass* elementClass, const char*
name, const char* longName, const char* description, const char* author)
{
#ifdef GST_API_VERSION_1
    gst_element_class_set_metadata(elementClass, name, longNmae, description,
author);
#else
    gst_element_class_set_details_simple(elementClass, name, longNmae,
description, author);
#endif
}

It's a bit icky here to have the #ifdef breaking the actual line of code. I
think the goal should be to move all of this code to more and more isolated
helpers that abstract away the differences between the versions.

> Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp:428
> +	       g_cclosure_marshal_generic, // Custom marshaller

I think you can probably remove the comment here.

> configure.ac:351
> -GSTREAMER_1_0_REQUIRED_VERSION=1.0
> +GSTREAMER_1_0_REQUIRED_VERSION=0.11.90

Why is this fix necessary?


More information about the webkit-reviews mailing list