WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Leakage fix
media.diff (text/plain), 6.87 KB, created by
Zan Dobersek
on 2009-02-02 11:29:25 PST
(
hide
)
Description:
Leakage fix
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2009-02-02 11:29:25 PST
Size:
6.87 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index 407ccb7..e60c2e6 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2009-02-02 Zan Dobersek <zandobersek@gmail.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Further implement MediaPlayerPrivate class on Gtk port. >+ >+ * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: >+ (WebCore::mediaPlayerPrivateErrorCallback): >+ (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): >+ (WebCore::MediaPlayerPrivate::maxTimeLoaded): >+ (WebCore::MediaPlayerPrivate::bytesLoaded): >+ (WebCore::MediaPlayerPrivate::totalBytesKnown): >+ (WebCore::MediaPlayerPrivate::totalBytes): >+ (WebCore::MediaPlayerPrivate::getSupportedTypes): >+ > 2009-02-02 Holger Hans Peter Freyther <zecke@selfish.org> > > Reviewed by Darin Adler. >diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp >index 1f0cac6..4e59f20 100644 >--- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp >+++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp >@@ -2,6 +2,7 @@ > * Copyright (C) 2007 Apple Inc. All rights reserved. > * Copyright (C) 2007 Collabora Ltd. All rights reserved. > * Copyright (C) 2007 Alp Toker <alp@atoker.com> >+ * Copyright (C) 2008 Zan Dobersek <zandobersek@gmail.com> > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Library General Public >@@ -50,6 +51,8 @@ using namespace std; > > namespace WebCore { > >+static bool gstInitialized = false; >+ > gboolean mediaPlayerPrivateErrorCallback(GstBus* bus, GstMessage* message, gpointer data) > { > if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) >@@ -58,11 +61,16 @@ gboolean mediaPlayerPrivateErrorCallback(GstBus* bus, GstMessage* message, gpoin > GOwnPtr<gchar> debug; > > gst_message_parse_error(message, &err.outPtr(), &debug.outPtr()); >- if (err->code == 3) { >+ if (err->code == GST_RESOURCE_ERROR_NOT_FOUND) { > LOG_VERBOSE(Media, "File not found"); > MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); > if (mp) > mp->loadingFailed(); >+ } else if (err->code == GST_STREAM_ERROR_TYPE_NOT_FOUND) { >+ LOG_VERBOSE(Media, "Could not determine type of stream"); >+ MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); >+ if (mp) >+ mp->loadingFailed(); > } else > LOG_VERBOSE(Media, "Error: %d, %s", err->code, err->message); > } >@@ -117,8 +125,6 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) > , m_rect(IntRect()) > , m_visible(true) > { >- >- static bool gstInitialized = false; > // FIXME: We should pass the arguments from the command line > if (!gstInitialized) { > gst_init(0, NULL); >@@ -385,35 +391,35 @@ float MediaPlayerPrivate::maxTimeSeekable() > > float MediaPlayerPrivate::maxTimeLoaded() > { >- // TODO > LOG_VERBOSE(Media, "maxTimeLoaded"); >- notImplemented(); >- return duration(); >+ >+ gint percent = 0; >+ GstQuery* bufferQuery = gst_query_new_buffering(GST_FORMAT_PERCENT); >+ gst_query_parse_buffering_percent(bufferQuery, NULL, &percent); >+ gst_query_unref(bufferQuery); >+ return duration() * percent / 100; > } > > unsigned MediaPlayerPrivate::bytesLoaded() > { >- notImplemented(); > LOG_VERBOSE(Media, "bytesLoaded"); >- /*if (!m_playBin) >+ if (!m_playBin) > return 0; > float dur = duration(); > float maxTime = maxTimeLoaded(); > if (!dur) >- return 0;*/ >- return 1;//totalBytes() * maxTime / dur; >+ return 0; >+ return totalBytes() * maxTime / dur; > } > > bool MediaPlayerPrivate::totalBytesKnown() > { >- notImplemented(); > LOG_VERBOSE(Media, "totalBytesKnown"); > return totalBytes() > 0; > } > > unsigned MediaPlayerPrivate::totalBytes() > { >- notImplemented(); > LOG_VERBOSE(Media, "totalBytes"); > if (!m_playBin) > return 0; >@@ -423,7 +429,11 @@ unsigned MediaPlayerPrivate::totalBytes() > > // Do something with m_source to get the total bytes of the media > >- return 100; >+ GstFormat fmt = GST_FORMAT_BYTES; >+ gint64 length = 0; >+ gst_element_query_duration(m_source, &fmt, &length); >+ >+ return length; > } > > void MediaPlayerPrivate::cancelLoad() >@@ -587,9 +597,51 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect) > > void MediaPlayerPrivate::getSupportedTypes(HashSet<String>& types) > { >- // FIXME: do the real thing >- notImplemented(); >- types.add(String("video/x-theora+ogg")); >+ if (!gstInitialized) { >+ gst_init(0, NULL); >+ gstInitialized = true; >+ } >+ >+ // These subtypes are already beeing supported by WebKit itself >+ HashSet<String> ignoredApplicationSubtypes; >+ ignoredApplicationSubtypes.add(String("javascript")); >+ ignoredApplicationSubtypes.add(String("ecmascript")); >+ ignoredApplicationSubtypes.add(String("x-javascript")); >+ ignoredApplicationSubtypes.add(String("xml")); >+ ignoredApplicationSubtypes.add(String("xhtml+xml")); >+ ignoredApplicationSubtypes.add(String("rss+xml")); >+ ignoredApplicationSubtypes.add(String("atom+xml")); >+ ignoredApplicationSubtypes.add(String("x-ftp-directory")); >+ ignoredApplicationSubtypes.add(String("x-java-applet")); >+ ignoredApplicationSubtypes.add(String("x-java-bean")); >+ ignoredApplicationSubtypes.add(String("x-java-vm")); >+ ignoredApplicationSubtypes.add(String("x-shockwave-flash")); >+ >+ GList* factories = gst_type_find_factory_get_list(); >+ for (GList* iterator = factories; iterator; iterator = iterator->next) { >+ GstTypeFindFactory* factory = GST_TYPE_FIND_FACTORY(iterator->data); >+ GstCaps* caps = gst_type_find_factory_get_caps(factory); >+ >+ // Splitting the capability by comma and taking the first part >+ // as capability can be something like "audio/x-wavpack, framed=(boolean)false" >+ gchar** capability = g_strsplit(gst_caps_to_string(caps), ",", 2); >+ gchar** mimetype = g_strsplit(capability[0], "/", 2); >+ >+ // GStreamer plugins can be capable of supporting types which WebKit supports >+ // by default. In that case, we should not consider these types supportable by GStreamer. >+ // Examples of what GStreamer can support but should not be added: >+ // text/plain, text/html, image/jpeg, application/xml >+ if (g_str_equal(mimetype[0], "audio") || >+ g_str_equal(mimetype[0], "video") || >+ (g_str_equal(mimetype[0], "application") && >+ !ignoredApplicationSubtypes.contains(String(mimetype[1])))) >+ types.add(String(capability[0])); >+ >+ g_strfreev(capability); >+ g_strfreev(mimetype); >+ } >+ >+ gst_plugin_feature_list_free(factories); > } > > void MediaPlayerPrivate::createGSTPlayBin(String url)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 16356
:
17847
|
17906
|
26099
|
26151
|
26163
|
26611
|
26612
|
27249
|
28391
|
38455
|
38474