Backed out changeset 938abddb1a2d (bug 1080995) for Linux mochitest failures.

This commit is contained in:
Ryan VanderMeulen 2014-12-16 11:41:36 -05:00
parent 351ab4aeb7
commit e9df582545
3 changed files with 4 additions and 69 deletions

View File

@ -88,9 +88,7 @@ GST_FUNC(LIBGSTREAMER, gst_pad_add_event_probe)
GST_FUNC(LIBGSTREAMER, gst_pad_alloc_buffer)
GST_FUNC(LIBGSTREAMER, gst_pad_get_negotiated_caps)
GST_FUNC(LIBGSTREAMER, gst_pad_set_bufferalloc_function)
GST_FUNC(LIBGSTREAMER, gst_registry_find_plugin)
GST_FUNC(LIBGSTREAMER, gst_registry_get_default)
GST_FUNC(LIBGSTREAMER, gst_plugin_feature_get_type)
GST_FUNC(LIBGSTREAMER, gst_segment_set_newsegment)
GST_FUNC(LIBGSTVIDEO, gst_video_format_get_component_height)
GST_FUNC(LIBGSTVIDEO, gst_video_format_get_component_offset)
@ -132,8 +130,6 @@ GST_FUNC(LIBGSTREAMER, gst_object_get_type)
GST_FUNC(LIBGSTREAMER, gst_pad_add_probe)
GST_FUNC(LIBGSTREAMER, gst_pad_get_current_caps)
GST_FUNC(LIBGSTREAMER, gst_pad_probe_info_get_query)
GST_FUNC(LIBGSTREAMER, gst_plugin_feature_get_plugin)
GST_FUNC(LIBGSTREAMER, gst_plugin_get_version)
GST_FUNC(LIBGSTREAMER, gst_query_add_allocation_meta)
GST_FUNC(LIBGSTREAMER, gst_query_add_allocation_param)
GST_FUNC(LIBGSTREAMER, gst_query_add_allocation_pool)

View File

@ -15,7 +15,6 @@
#endif
#include "GStreamerFormatHelper.h"
#include "VideoUtils.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/TimeRanges.h"
#include "mozilla/Endian.h"
#include "mozilla/Preferences.h"
@ -23,10 +22,6 @@
#include "GStreamerLoader.h"
#include "gfx2DGlue.h"
#include <gst/gstplugin.h>
#include <gst/gstpluginfeature.h>
#include <gst/gstregistry.h>
namespace mozilla {
using namespace gfx;
@ -1173,71 +1168,17 @@ GStreamerReader::PlayElementAddedCb(GstBin *aBin, GstElement *aElement,
g_free(name);
}
/**
* Helper to calculate the length of a C string constant at compile time.
* Substract one from the array length for the trailing null.
*/
#define STRING_LENGTH(string) (ArrayLength(string) - 1)
/** Check proposed element factories for acceptability. */
bool GStreamerReader::IsFactoryBlacklisted(GstElementFactory* aFactory)
{
// Retrieve version string for the element.
#if GST_VERSION_MAJOR >= 1
GstPlugin* plugin = gst_plugin_feature_get_plugin(GST_PLUGIN_FEATURE(aFactory));
const gchar* version = plugin ? gst_plugin_get_version(plugin) : "unknown";
#else
const gchar* plugin_name = GST_PLUGIN_FEATURE(aFactory)->plugin_name;
if (!plugin_name) {
return true;
}
GstPlugin* plugin = gst_default_registry_find_plugin(plugin_name);
const gchar* version = plugin ? plugin->desc.version : "unknown";
#endif
if (!plugin) {
return true;
}
// Retrieve the element name.
const gchar* name = gst_element_get_name(aFactory);
// Reject h264parse <= 0.10.23.
const char badname[] = "h264parse";
const char version_base[] = "0.10.";
// Length needed to compare with version base plus two more digits.
const size_t version_min = STRING_LENGTH(version_base) + 2;
if (strcmp(name, badname) == 0 &&
strncmp(version, version_base, strlen(version_base)) == 0 &&
strlen(version) >= version_min &&
atoi(version + strlen(version_base)) <= 23) {
gst_object_unref(plugin);
return true;
}
// Clean up.
gst_object_unref(plugin);
// Factory isn't blacklisted.
return false;
}
/** Filter elements to control autoplug selection. */
bool
GStreamerReader::ShouldAutoplugFactory(GstElementFactory* aFactory, GstCaps* aCaps)
{
/* Blacklist unstable elements. */
if (IsFactoryBlacklisted(aFactory)) {
return false;
}
/* Filter Demuxers and Decoders for supported formats. */
bool autoplug;
const gchar* klass = gst_element_factory_get_klass(aFactory);
const gchar *klass = gst_element_factory_get_klass(aFactory);
if (strstr(klass, "Demuxer") && !strstr(klass, "Metadata")) {
autoplug = GStreamerFormatHelper::Instance()->CanHandleContainerCaps(aCaps);
} else if (strstr(klass, "Decoder") && !strstr(klass, "Generic")) {
autoplug = GStreamerFormatHelper::Instance()->CanHandleCodecCaps(aCaps);
} else {
/* Let everything else be autoplugged. */
/* we only filter demuxers and decoders, let everything else be autoplugged */
autoplug = true;
}

View File

@ -166,11 +166,9 @@ private:
static void PlayElementAddedCb(GstBin *aBin, GstElement *aElement,
gpointer *aUserData);
/* Called during decoding, to decide whether a (sub)stream should be
* decoded or ignored. */
/* Called during decoding, to decide whether a (sub)stream should be decoded or
* ignored */
static bool ShouldAutoplugFactory(GstElementFactory* aFactory, GstCaps* aCaps);
/* Called from ShouldAutoplugFactory to check for blacklisted elements. */
static bool IsFactoryBlacklisted(GstElementFactory* aFactory);
/* Called by decodebin during autoplugging. We use it to apply our
* container/codec whitelist.