Bug 846465 - Fix OMX plugin crash on HTC One X r=doublec

This commit is contained in:
Edwin Flores 2013-03-22 15:24:47 +13:00
parent 4af1d0d29a
commit 26d9c1a784
8 changed files with 103 additions and 2 deletions

View File

@ -164,7 +164,16 @@ static const char* GetOmxLibraryName()
ALOG("Android Device is: %s", NS_LossyConvertUTF16toASCII(device).get());
}
if (version == 15 &&
nsAutoString manufacturer;
rv = infoService->GetPropertyAsAString(NS_LITERAL_STRING("manufacturer"), manufacturer);
if (NS_SUCCEEDED(rv)) {
ALOG("Android Manufacturer is: %s", NS_LossyConvertUTF16toASCII(manufacturer).get());
}
if (version >= 16 && manufacturer.Find("HTC") == 0) {
return "libomxpluginjb-htc.so";
}
else if (version == 15 &&
(device.Find("LT28", false) == 0 ||
device.Find("LT26", false) == 0 ||
device.Find("LT22", false) == 0 ||

View File

@ -64,6 +64,14 @@ private:
MediaStreamSource(const MediaStreamSource &);
MediaStreamSource &operator=(const MediaStreamSource &);
#ifdef MOZ_ANDROID_HTC_WORKAROUND
// libstagefright on some Jellybean HTC devices (at least the Tegra 3 One X)
// calls this function and expects this magic number to be returned when
// sniffing audio stream formats.
// It is unclear what this is for or what it does.
virtual uint32_t MagicalHTCIncantation() { return 0x3f0; }
#endif
};
MediaStreamSource::MediaStreamSource(PluginHost *aPluginHost, Decoder *aDecoder) :

View File

@ -0,0 +1,66 @@
# Copyright 2012 Mozilla Foundation and Mozilla contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE_NAME = omxpluginjb-htc
LIBRARY_NAME = omxpluginjb-htc
FORCE_SHARED_LIB = 1
# Don't use STL wrappers; this isn't Gecko code
STL_FLAGS =
# must link statically with the CRT; this isn't Gecko code
USE_STATIC_LIBS = 1
# Need to custom install OMX media plugin
NO_DIST_INSTALL = 1
NO_INSTALL = 1
CPPSRCS = \
OmxPluginJB-HTC.cpp \
$(NULL)
include $(topsrcdir)/config/rules.mk
ifdef GNU_CXX
# Turn off C++ 11 features due to conflicts with Android OS headers and char16_t definition
CXXFLAGS += -std=gnu++98
endif
INCLUDES += \
-I$(srcdir)/../../../content/media/plugins \
$(NULL)
EXTRA_DSO_LDOPTS += \
-L$(DEPTH)/media/omx-plugin/lib/ics/libutils \
-lutils \
-L$(DEPTH)/media/omx-plugin/lib/ics/libstagefright \
-lstagefright \
$(NULL)
INCLUDES += \
-I$(srcdir)/../include/ics \
-I$(srcdir)/../include/ics/media/stagefright/openmax \
$(NULL)
libs:: $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX)
$(INSTALL) $< $(DEPTH)/dist/bin
libs:: $(PROGRAMS)

View File

@ -0,0 +1,9 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#define MOZ_STAGEFRIGHT_OFF_T off64_t
#define MOZ_ANDROID_ICS
#define MOZ_ANDROID_HTC_WORKAROUND
#include "../OmxPlugin.cpp"

View File

@ -0,0 +1,7 @@
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MODULE = 'omxpluginjb-htc'

View File

@ -47,6 +47,7 @@
@BINPATH@/@DLL_PREFIX@omxplugingb@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxplugingb235@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxpluginhc@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxpluginjb-htc@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxpluginsony@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@omxpluginfroyo@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@

View File

@ -347,7 +347,7 @@ INNER_ROBOCOP_PACKAGE=echo 'Testing is disabled - No Robocop for you'
endif
ifdef MOZ_OMX_PLUGIN
DIST_FILES += libomxplugin.so libomxplugingb.so libomxplugingb235.so libomxpluginhc.so libomxpluginsony.so libomxpluginfroyo.so
DIST_FILES += libomxplugin.so libomxplugingb.so libomxplugingb235.so libomxpluginhc.so libomxpluginsony.so libomxpluginfroyo.so libomxpluginjb-htc.so
endif
PKG_SUFFIX = .apk

View File

@ -118,6 +118,7 @@ if CONFIG['MOZ_OMX_PLUGIN']:
'media/omx-plugin/lib/hc/libstagefright',
'media/omx-plugin/hc',
'media/omx-plugin/sony',
'media/omx-plugin/jb-htc',
])
if not CONFIG['MOZ_NATIVE_PNG']: