mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 08:37:30 +09:00
parent
b586913598
commit
2531de02eb
85 changed files with 68 additions and 1357 deletions
|
|
@ -187,10 +187,6 @@ static void opensl_destroy(cubeb * ctx);
|
|||
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
// The bionic header file on B2G contains the required
|
||||
// declarations on all releases.
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
|
||||
#if (__ANDROID_API__ >= ANDROID_VERSION_LOLLIPOP)
|
||||
typedef int (system_property_get)(const char*, char*);
|
||||
|
||||
|
|
@ -212,7 +208,6 @@ __system_property_get(const char* name, char* value)
|
|||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static int
|
||||
get_android_version(void)
|
||||
|
|
|
|||
|
|
@ -95,19 +95,6 @@
|
|||
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
#endif
|
||||
|
||||
/* necessary for boot animation code (Gonk) */
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#define PNG_bKGD_SUPPORTED
|
||||
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
#define PNG_EASY_ACCESS_SUPPORTED
|
||||
#define PNG_READ_bKGD_SUPPORTED
|
||||
#define PNG_READ_BGR_SUPPORTED
|
||||
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||
#endif
|
||||
|
||||
#define PNG_WRITE_SUPPORTED
|
||||
#define PNG_WRITE_APNG_SUPPORTED
|
||||
#define PNG_WRITE_tRNS_SUPPORTED
|
||||
|
|
|
|||
|
|
@ -10,11 +10,7 @@
|
|||
#include <stagefright/MetaData.h>
|
||||
#include <stagefright/OMXCodec.h>
|
||||
#include <media/stagefright/MediaErrors.h>
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <OMX.h>
|
||||
#else
|
||||
#include <stagefright/OMXClient.h>
|
||||
#endif
|
||||
#include <algorithm>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
|
|
@ -125,7 +121,6 @@ public:
|
|||
bool ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs);
|
||||
};
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
static class OmxClientInstance {
|
||||
public:
|
||||
OmxClientInstance()
|
||||
|
|
@ -156,7 +151,6 @@ private:
|
|||
OMXClient *mClient;
|
||||
status_t mStatus;
|
||||
} sClientInstance;
|
||||
#endif
|
||||
|
||||
OmxDecoder::OmxDecoder(PluginHost *aPluginHost, Decoder *aDecoder) :
|
||||
mPluginHost(aPluginHost),
|
||||
|
|
@ -210,16 +204,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
static sp<IOMX> sOMX = nullptr;
|
||||
static sp<IOMX> GetOMX() {
|
||||
if(sOMX.get() == nullptr) {
|
||||
sOMX = reinterpret_cast<IOMX*>(new OMX);
|
||||
}
|
||||
return sOMX;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint32_t
|
||||
GetDefaultStagefrightFlags(PluginHost *aPluginHost)
|
||||
{
|
||||
|
|
@ -246,11 +230,6 @@ GetDefaultStagefrightFlags(PluginHost *aPluginHost)
|
|||
|
||||
static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Flag value of zero means return a hardware or software decoder
|
||||
// depending on what the device supports.
|
||||
return 0;
|
||||
#else
|
||||
// Check whether the user has set a pref to override our default OMXCodec
|
||||
// CreationFlags flags. This is useful for A/B testing hardware and software
|
||||
// decoders for performance and bugs. The interesting flag values are:
|
||||
|
|
@ -271,7 +250,6 @@ static uint32_t GetVideoCreationFlags(PluginHost* aPluginHost)
|
|||
flags |= GetDefaultStagefrightFlags(aPluginHost);
|
||||
|
||||
return static_cast<uint32_t>(flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
enum ColorFormatSupport {
|
||||
|
|
@ -481,11 +459,7 @@ bool OmxDecoder::Init()
|
|||
|
||||
int64_t totalDurationUs = 0;
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
sp<IOMX> omx = GetOMX();
|
||||
#else
|
||||
sp<IOMX> omx = sClientInstance.get()->interface();
|
||||
#endif
|
||||
|
||||
sp<MediaSource> videoTrack;
|
||||
sp<MediaSource> videoSource;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ using namespace android;
|
|||
#include "runnable_utils.h"
|
||||
|
||||
// Gecko
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
|
||||
#include "GonkBufferQueueProducer.h"
|
||||
#endif
|
||||
#include "GonkNativeWindow.h"
|
||||
#include "GrallocImages.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
|
|
@ -326,30 +323,16 @@ public:
|
|||
mHeight = aHeight;
|
||||
|
||||
sp<Surface> surface = nullptr;
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
|
||||
sp<IGraphicBufferProducer> producer;
|
||||
sp<IGonkGraphicBufferConsumer> consumer;
|
||||
GonkBufferQueue::createBufferQueue(&producer, &consumer);
|
||||
mNativeWindow = new GonkNativeWindow(consumer);
|
||||
#else
|
||||
mNativeWindow = new GonkNativeWindow();
|
||||
#endif
|
||||
if (mNativeWindow.get()) {
|
||||
// listen to buffers queued by MediaCodec::RenderOutputBufferAndRelease().
|
||||
mNativeWindow->setNewFrameCallback(this);
|
||||
// XXX remove buffer changes after a better solution lands - bug 1009420
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 21
|
||||
static_cast<GonkBufferQueueProducer*>(producer.get())->setSynchronousMode(false);
|
||||
// More spare buffers to avoid OMX decoder waiting for native window
|
||||
consumer->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
|
||||
surface = new Surface(producer);
|
||||
#else
|
||||
sp<GonkBufferQueue> bq = mNativeWindow->getBufferQueue();
|
||||
bq->setSynchronousMode(false);
|
||||
// More spare buffers to avoid OMX decoder waiting for native window
|
||||
bq->setMaxAcquiredBufferCount(WEBRTC_OMX_H264_MIN_DECODE_BUFFERS);
|
||||
surface = new Surface(bq);
|
||||
#endif
|
||||
}
|
||||
status_t result = mCodec->configure(config, surface, nullptr, 0);
|
||||
if (result == OK) {
|
||||
|
|
|
|||
|
|
@ -2217,11 +2217,7 @@ public:
|
|||
#if defined(MOZILLA_INTERNAL_API)
|
||||
if (buffer) {
|
||||
// Create a video frame using |buffer|.
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
RefPtr<PlanarYCbCrImage> yuvImage = new GrallocImage();
|
||||
#else
|
||||
RefPtr<PlanarYCbCrImage> yuvImage = image_container_->CreatePlanarYCbCrImage();
|
||||
#endif
|
||||
uint8_t* frame = const_cast<uint8_t*>(static_cast<const uint8_t*> (buffer));
|
||||
|
||||
PlanarYCbCrData yuvData;
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@
|
|||
#ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_ANDROID_H
|
||||
#define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_UTILITY_ANDROID_H
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
#include <jni.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/modules/audio_device/audio_device_utility.h"
|
||||
|
|
|
|||
|
|
@ -9,18 +9,14 @@
|
|||
*/
|
||||
|
||||
#include "webrtc/modules/audio_device/android/audio_manager.h"
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
#include "AndroidJNIWrapper.h"
|
||||
#endif
|
||||
|
||||
#include <android/log.h>
|
||||
|
||||
#include "webrtc/base/arraysize.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/modules/audio_device/android/audio_common.h"
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
#include "webrtc/modules/utility/interface/helpers_android.h"
|
||||
#endif
|
||||
|
||||
#define TAG "AudioManager"
|
||||
#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, TAG, __VA_ARGS__)
|
||||
|
|
@ -31,14 +27,11 @@
|
|||
|
||||
namespace webrtc {
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
static JavaVM* g_jvm = NULL;
|
||||
static jobject g_context = NULL;
|
||||
static jclass g_audio_manager_class = NULL;
|
||||
#endif
|
||||
|
||||
void AudioManager::SetAndroidAudioDeviceObjects(void* jvm, void* context) {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
ALOGD("SetAndroidAudioDeviceObjects%s", GetThreadInfo().c_str());
|
||||
|
||||
CHECK(jvm);
|
||||
|
|
@ -65,11 +58,9 @@ void AudioManager::SetAndroidAudioDeviceObjects(void* jvm, void* context) {
|
|||
jni->RegisterNatives(g_audio_manager_class,
|
||||
native_methods, arraysize(native_methods));
|
||||
CHECK_EXCEPTION(jni) << "Error during RegisterNatives";
|
||||
#endif
|
||||
}
|
||||
|
||||
void AudioManager::ClearAndroidAudioDeviceObjects() {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
ALOGD("ClearAndroidAudioDeviceObjects%s", GetThreadInfo().c_str());
|
||||
JNIEnv* jni = GetEnv(g_jvm);
|
||||
CHECK(jni) << "AttachCurrentThread must be called on this tread";
|
||||
|
|
@ -80,36 +71,28 @@ void AudioManager::ClearAndroidAudioDeviceObjects() {
|
|||
DeleteGlobalRef(jni, g_context);
|
||||
g_context = NULL;
|
||||
g_jvm = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
AudioManager::AudioManager()
|
||||
: initialized_(false) {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
j_audio_manager_ = NULL;
|
||||
ALOGD("ctor%s", GetThreadInfo().c_str());
|
||||
#endif
|
||||
CHECK(HasDeviceObjects());
|
||||
CreateJavaInstance();
|
||||
}
|
||||
|
||||
AudioManager::~AudioManager() {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
ALOGD("~dtor%s", GetThreadInfo().c_str());
|
||||
#endif
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
Close();
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
AttachThreadScoped ats(g_jvm);
|
||||
JNIEnv* jni = ats.env();
|
||||
jni->DeleteGlobalRef(j_audio_manager_);
|
||||
j_audio_manager_ = NULL;
|
||||
#endif
|
||||
DCHECK(!initialized_);
|
||||
}
|
||||
|
||||
bool AudioManager::Init() {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
ALOGD("Init%s", GetThreadInfo().c_str());
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
DCHECK(!initialized_);
|
||||
|
|
@ -122,13 +105,11 @@ bool AudioManager::Init() {
|
|||
ALOGE("init failed!");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
initialized_ = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioManager::Close() {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
ALOGD("Close%s", GetThreadInfo().c_str());
|
||||
DCHECK(thread_checker_.CalledOnValidThread());
|
||||
if (!initialized_)
|
||||
|
|
@ -139,12 +120,10 @@ bool AudioManager::Close() {
|
|||
jni, g_audio_manager_class, "dispose", "()V");
|
||||
jni->CallVoidMethod(j_audio_manager_, disposeID);
|
||||
CHECK_EXCEPTION(jni);
|
||||
#endif
|
||||
initialized_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
void JNICALL AudioManager::CacheAudioParameters(JNIEnv* env, jobject obj,
|
||||
jint sample_rate, jint channels, jlong nativeAudioManager) {
|
||||
webrtc::AudioManager* this_object =
|
||||
|
|
@ -162,7 +141,6 @@ void AudioManager::OnCacheAudioParameters(
|
|||
playout_parameters_.reset(sample_rate, channels);
|
||||
record_parameters_.reset(sample_rate, channels);
|
||||
}
|
||||
#endif
|
||||
|
||||
AudioParameters AudioManager::GetPlayoutAudioParameters() const {
|
||||
CHECK(playout_parameters_.is_valid());
|
||||
|
|
@ -175,15 +153,10 @@ AudioParameters AudioManager::GetRecordAudioParameters() const {
|
|||
}
|
||||
|
||||
bool AudioManager::HasDeviceObjects() {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
return (g_jvm && g_context && g_audio_manager_class);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void AudioManager::CreateJavaInstance() {
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
ALOGD("CreateJavaInstance");
|
||||
AttachThreadScoped ats(g_jvm);
|
||||
JNIEnv* jni = ats.env();
|
||||
|
|
@ -198,7 +171,6 @@ void AudioManager::CreateJavaInstance() {
|
|||
j_audio_manager_ = jni->NewGlobalRef(j_audio_manager_);
|
||||
CHECK_EXCEPTION(jni) << "Error during NewGlobalRef";
|
||||
CHECK(j_audio_manager_);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
|||
|
|
@ -11,17 +11,13 @@
|
|||
#ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
|
||||
#define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_AUDIO_MANAGER_H_
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
#include <jni.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/modules/audio_device/android/audio_common.h"
|
||||
#include "webrtc/modules/audio_device/include/audio_device_defines.h"
|
||||
#include "webrtc/modules/audio_device/audio_device_generic.h"
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
#include "webrtc/modules/utility/interface/helpers_android.h"
|
||||
#endif
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
|
@ -100,14 +96,12 @@ class AudioManager {
|
|||
bool initialized() const { return initialized_; }
|
||||
|
||||
private:
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
// Called from Java side so we can cache the native audio parameters.
|
||||
// This method will be called by the WebRtcAudioManager constructor, i.e.
|
||||
// on the same thread that this object is created on.
|
||||
static void JNICALL CacheAudioParameters(JNIEnv* env, jobject obj,
|
||||
jint sample_rate, jint channels, jlong nativeAudioManager);
|
||||
void OnCacheAudioParameters(JNIEnv* env, jint sample_rate, jint channels);
|
||||
#endif
|
||||
|
||||
// Returns true if SetAndroidAudioDeviceObjects() has been called
|
||||
// successfully.
|
||||
|
|
@ -121,10 +115,8 @@ class AudioManager {
|
|||
// other methods are called from the same thread.
|
||||
rtc::ThreadChecker thread_checker_;
|
||||
|
||||
#if !defined(MOZ_WIDGET_GONK)
|
||||
// The Java WebRtcAudioManager instance.
|
||||
jobject j_audio_manager_;
|
||||
#endif
|
||||
|
||||
// Set to true by Init() and false by Close().
|
||||
bool initialized_;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "webrtc/common_types.h"
|
||||
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
#include <jni.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ class WEBRTC_DLLEXPORT VideoEngine {
|
|||
// user receives callbacks for generated trace messages.
|
||||
static int SetTraceCallback(TraceCallback* callback);
|
||||
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
|
||||
// Android specific.
|
||||
static int SetAndroidObjects(JavaVM* java_vm);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue