mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-23 00:47:31 +09:00
parent
b586913598
commit
2531de02eb
85 changed files with 68 additions and 1357 deletions
|
|
@ -1505,20 +1505,6 @@ DOMAudioNodeMediaStream::CreateTrackUnionStreamAsInput(nsPIDOMWindowInner* aWind
|
|||
DOMHwMediaStream::DOMHwMediaStream(nsPIDOMWindowInner* aWindow)
|
||||
: DOMLocalMediaStream(aWindow, nullptr)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (!mWindow) {
|
||||
NS_ERROR("Expected window here.");
|
||||
mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
|
||||
return;
|
||||
}
|
||||
nsIDocument* doc = mWindow->GetExtantDoc();
|
||||
if (!doc) {
|
||||
NS_ERROR("Expected document here.");
|
||||
mPrincipalHandle = PRINCIPAL_HANDLE_NONE;
|
||||
return;
|
||||
}
|
||||
mPrincipalHandle = MakePrincipalHandle(doc->NodePrincipal());
|
||||
#endif
|
||||
}
|
||||
|
||||
DOMHwMediaStream::~DOMHwMediaStream()
|
||||
|
|
@ -1545,31 +1531,8 @@ DOMHwMediaStream::Init(MediaStream* stream, OverlayImage* aImage)
|
|||
{
|
||||
SourceMediaStream* srcStream = stream->AsSourceStream();
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (aImage) {
|
||||
mOverlayImage = aImage;
|
||||
} else {
|
||||
Data imageData;
|
||||
imageData.mOverlayId = DEFAULT_IMAGE_ID;
|
||||
imageData.mSize.width = DEFAULT_IMAGE_WIDTH;
|
||||
imageData.mSize.height = DEFAULT_IMAGE_HEIGHT;
|
||||
|
||||
mOverlayImage = new OverlayImage();
|
||||
mOverlayImage->SetData(imageData);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (srcStream) {
|
||||
VideoSegment segment;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
const StreamTime delta = STREAM_TIME_MAX; // Because MediaStreamGraph will run out frames in non-autoplay mode,
|
||||
// we must give it bigger frame length to cover this situation.
|
||||
|
||||
RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
|
||||
mozilla::gfx::IntSize size = image->GetSize();
|
||||
|
||||
segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
|
||||
#endif
|
||||
srcStream->AddTrack(TRACK_VIDEO_PRIMARY, 0, new VideoSegment());
|
||||
srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
|
||||
srcStream->AdvanceKnownTracksTime(STREAM_TIME_MAX);
|
||||
|
|
@ -1579,30 +1542,13 @@ DOMHwMediaStream::Init(MediaStream* stream, OverlayImage* aImage)
|
|||
int32_t
|
||||
DOMHwMediaStream::RequestOverlayId()
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
return mOverlayImage->GetOverlayId();
|
||||
#else
|
||||
/*** STUB ***/
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DOMHwMediaStream::SetImageSize(uint32_t width, uint32_t height)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (mOverlayImage->GetSidebandStream().IsValid()) {
|
||||
OverlayImage::SidebandStreamData imgData;
|
||||
imgData.mStream = mOverlayImage->GetSidebandStream();
|
||||
imgData.mSize = IntSize(width, height);
|
||||
mOverlayImage->SetData(imgData);
|
||||
} else {
|
||||
OverlayImage::Data imgData;
|
||||
imgData.mOverlayId = mOverlayImage->GetOverlayId();
|
||||
imgData.mSize = IntSize(width, height);
|
||||
mOverlayImage->SetData(imgData);
|
||||
}
|
||||
#endif
|
||||
|
||||
SourceMediaStream* srcStream = GetInputStream()->AsSourceStream();
|
||||
StreamTracks::Track* track = srcStream->FindTrack(TRACK_VIDEO_PRIMARY);
|
||||
|
||||
|
|
@ -1610,23 +1556,6 @@ DOMHwMediaStream::SetImageSize(uint32_t width, uint32_t height)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Clear the old segment.
|
||||
// Changing the existing content of segment is a Very BAD thing, and this way will
|
||||
// confuse consumers of MediaStreams.
|
||||
// It is only acceptable for DOMHwMediaStream
|
||||
// because DOMHwMediaStream doesn't have consumers of TV streams currently.
|
||||
track->GetSegment()->Clear();
|
||||
|
||||
// Change the image size.
|
||||
const StreamTime delta = STREAM_TIME_MAX;
|
||||
RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
|
||||
mozilla::gfx::IntSize size = image->GetSize();
|
||||
VideoSegment segment;
|
||||
|
||||
segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
|
||||
srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1635,9 +1564,6 @@ DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage)
|
|||
if (!aImage) {
|
||||
return;
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
mOverlayImage = aImage;
|
||||
#endif
|
||||
|
||||
SourceMediaStream* srcStream = GetInputStream()->AsSourceStream();
|
||||
StreamTracks::Track* track = srcStream->FindTrack(TRACK_VIDEO_PRIMARY);
|
||||
|
|
@ -1646,34 +1572,10 @@ DOMHwMediaStream::SetOverlayImage(OverlayImage* aImage)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Clear the old segment.
|
||||
// Changing the existing content of segment is a Very BAD thing, and this way will
|
||||
// confuse consumers of MediaStreams.
|
||||
// It is only acceptable for DOMHwMediaStream
|
||||
// because DOMHwMediaStream doesn't have consumers of TV streams currently.
|
||||
track->GetSegment()->Clear();
|
||||
|
||||
// Change the image size.
|
||||
const StreamTime delta = STREAM_TIME_MAX;
|
||||
RefPtr<Image> image = static_cast<Image*>(mOverlayImage.get());
|
||||
mozilla::gfx::IntSize size = image->GetSize();
|
||||
VideoSegment segment;
|
||||
|
||||
segment.AppendFrame(image.forget(), delta, size, mPrincipalHandle);
|
||||
srcStream->AppendToTrack(TRACK_VIDEO_PRIMARY, &segment);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DOMHwMediaStream::SetOverlayId(int32_t aOverlayId)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
OverlayImage::Data imgData;
|
||||
|
||||
imgData.mOverlayId = aOverlayId;
|
||||
imgData.mSize = mOverlayImage->GetSize();
|
||||
|
||||
mOverlayImage->SetData(imgData);
|
||||
#endif
|
||||
/*** STUB ***/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -833,9 +833,6 @@ class DOMHwMediaStream : public DOMLocalMediaStream
|
|||
{
|
||||
typedef mozilla::gfx::IntSize IntSize;
|
||||
typedef layers::OverlayImage OverlayImage;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
typedef layers::OverlayImage::Data Data;
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit DOMHwMediaStream(nsPIDOMWindowInner* aWindow);
|
||||
|
|
@ -853,14 +850,6 @@ protected:
|
|||
|
||||
private:
|
||||
void Init(MediaStream* aStream, OverlayImage* aImage);
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
const int DEFAULT_IMAGE_ID = 0x01;
|
||||
const int DEFAULT_IMAGE_WIDTH = 400;
|
||||
const int DEFAULT_IMAGE_HEIGHT = 300;
|
||||
RefPtr<OverlayImage> mOverlayImage;
|
||||
PrincipalHandle mPrincipalHandle;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
|
|
@ -9,9 +9,6 @@
|
|||
#include "VideoUtils.h"
|
||||
#include "ImageContainer.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <cutils/properties.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
namespace mozilla {
|
||||
|
|
@ -93,31 +90,6 @@ ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
|
|||
aPlane.mStride > 0 && aPlane.mWidth <= aPlane.mStride;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
static bool
|
||||
IsYV12Format(const VideoData::YCbCrBuffer::Plane& aYPlane,
|
||||
const VideoData::YCbCrBuffer::Plane& aCbPlane,
|
||||
const VideoData::YCbCrBuffer::Plane& aCrPlane)
|
||||
{
|
||||
return
|
||||
aYPlane.mWidth % 2 == 0 &&
|
||||
aYPlane.mHeight % 2 == 0 &&
|
||||
aYPlane.mWidth / 2 == aCbPlane.mWidth &&
|
||||
aYPlane.mHeight / 2 == aCbPlane.mHeight &&
|
||||
aCbPlane.mWidth == aCrPlane.mWidth &&
|
||||
aCbPlane.mHeight == aCrPlane.mHeight;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsInEmulator()
|
||||
{
|
||||
char propQemu[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.kernel.qemu", propQemu, "");
|
||||
return !strncmp(propQemu, "1", 1);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
VideoData::VideoData(int64_t aOffset,
|
||||
int64_t aTime,
|
||||
int64_t aDuration,
|
||||
|
|
@ -310,19 +282,8 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo,
|
|||
aTimecode,
|
||||
aInfo.mDisplay,
|
||||
0));
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0];
|
||||
const YCbCrBuffer::Plane &Cb = aBuffer.mPlanes[1];
|
||||
const YCbCrBuffer::Plane &Cr = aBuffer.mPlanes[2];
|
||||
#endif
|
||||
|
||||
// Currently our decoder only knows how to output to ImageFormat::PLANAR_YCBCR
|
||||
// format.
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (IsYV12Format(Y, Cb, Cr) && !IsInEmulator()) {
|
||||
v->mImage = new layers::GrallocImage();
|
||||
}
|
||||
#endif
|
||||
if (!v->mImage) {
|
||||
v->mImage = aContainer->CreatePlanarYCbCrImage();
|
||||
}
|
||||
|
|
@ -341,20 +302,6 @@ VideoData::CreateAndCopyData(const VideoInfo& aInfo,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (!videoImage->IsValid() && IsYV12Format(Y, Cb, Cr)) {
|
||||
// Failed to allocate gralloc. Try fallback.
|
||||
v->mImage = aContainer->CreatePlanarYCbCrImage();
|
||||
if (!v->mImage) {
|
||||
return nullptr;
|
||||
}
|
||||
videoImage = v->mImage->AsPlanarYCbCrImage();
|
||||
if (!VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture,
|
||||
true /* aCopyData */)) {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return v.forget();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@
|
|||
#include "nsArray.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsHashPropertyBag.h"
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsIAudioManager.h"
|
||||
#endif
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIUUIDGenerator.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
|
@ -1569,7 +1566,7 @@ private:
|
|||
RefPtr<MediaManager> mManager; // get ref to this when creating the runnable
|
||||
};
|
||||
|
||||
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID)
|
||||
class GetUserMediaRunnableWrapper : public Runnable
|
||||
{
|
||||
public:
|
||||
|
|
@ -3052,18 +3049,6 @@ MediaManager::Observe(nsISupports* aSubject, const char* aTopic,
|
|||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
else if (!strcmp(aTopic, "phone-state-changed")) {
|
||||
nsString state(aData);
|
||||
nsresult rv;
|
||||
uint32_t phoneState = state.ToInteger(&rv);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && phoneState == nsIAudioManager::PHONE_STATE_IN_CALL) {
|
||||
StopMediaStreams();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "nsIPropertyBag2.h"
|
||||
|
||||
#if defined(ANDROID) || defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID)
|
||||
#include "android/log.h"
|
||||
#define ALOG(args...) __android_log_print(ANDROID_LOG_INFO, "AndroidMediaPluginHost" , ## args)
|
||||
#else
|
||||
|
|
@ -134,7 +134,7 @@ static bool IsOmxSupported()
|
|||
// nullptr is returned if Omx decoding is not supported on the device,
|
||||
static const char* GetOmxLibraryName()
|
||||
{
|
||||
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID)
|
||||
nsCOMPtr<nsIPropertyBag2> infoService = do_GetService("@mozilla.org/system-info;1");
|
||||
NS_ASSERTION(infoService, "Could not find a system info service");
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ static const char* GetOmxLibraryName()
|
|||
if (!IsOmxSupported())
|
||||
return nullptr;
|
||||
|
||||
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID)
|
||||
if (version >= 17) {
|
||||
return "libomxpluginkk.so";
|
||||
}
|
||||
|
|
@ -180,8 +180,6 @@ static const char* GetOmxLibraryName()
|
|||
// Ice Cream Sandwich and Jellybean
|
||||
return "libomxplugin.so";
|
||||
|
||||
#elif defined(ANDROID) && defined(MOZ_WIDGET_GONK)
|
||||
return "libomxplugin.so";
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -9,12 +9,7 @@
|
|||
#include <opus/opus.h>
|
||||
|
||||
#undef LOG
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <android/log.h>
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
|
||||
#else
|
||||
#define LOG(args, ...)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,7 @@
|
|||
#include "VideoUtils.h"
|
||||
|
||||
#undef LOG
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <android/log.h>
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
|
||||
#else
|
||||
#define LOG(args, ...)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
|||
|
|
@ -13,12 +13,7 @@
|
|||
#include "GeckoProfiler.h"
|
||||
|
||||
#undef LOG
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <android/log.h>
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
|
||||
#else
|
||||
#define LOG(args, ...)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
|||
|
|
@ -270,11 +270,7 @@ GeckoMediaPluginServiceParent::InitStorage()
|
|||
|
||||
// Directory service is main thread only, so cache the profile dir here
|
||||
// so that we can use it off main thread.
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsresult rv = NS_NewLocalFile(NS_LITERAL_STRING("/data/b2g/mozilla"), false, getter_AddRefs(mStorageBaseDir));
|
||||
#else
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mStorageBaseDir));
|
||||
#endif
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -18,18 +18,6 @@
|
|||
#include <opus/opus.h>
|
||||
#include "opus/opus_multistream.h"
|
||||
|
||||
// On Android JellyBean, the hardware.h header redefines version_major and
|
||||
// version_minor, which breaks our build. See:
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=912702#c6
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#ifdef version_major
|
||||
#undef version_major
|
||||
#endif
|
||||
#ifdef version_minor
|
||||
#undef version_minor
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
extern LazyLogModule gMediaDecoderLog;
|
||||
|
|
|
|||
|
|
@ -7,12 +7,7 @@
|
|||
#include "GeckoProfiler.h"
|
||||
|
||||
#undef LOG
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include <android/log.h>
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "MediaEncoder", ## args);
|
||||
#else
|
||||
#define LOG(args, ...)
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,6 @@
|
|||
|
||||
#include "OMX_VideoExt.h" // For VP8.
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK) && (ANDROID_VERSION == 20 || ANDROID_VERSION == 19)
|
||||
#define OMX_PLATFORM_GONK
|
||||
#include "GonkOmxPlatformLayer.h"
|
||||
#endif
|
||||
|
||||
#include "VPXDecoder.h"
|
||||
|
||||
#ifdef LOG
|
||||
|
|
|
|||
|
|
@ -47,23 +47,6 @@ MediaSystemResourceService::MediaSystemResourceService()
|
|||
: mDestroyed(false)
|
||||
{
|
||||
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// The maximum number of hardware resoureces available.
|
||||
// XXX need to hange to a dynamic way.
|
||||
enum
|
||||
{
|
||||
VIDEO_DECODER_COUNT = 1,
|
||||
VIDEO_ENCODER_COUNT = 1
|
||||
};
|
||||
|
||||
MediaSystemResource* resource;
|
||||
|
||||
resource = new MediaSystemResource(VIDEO_DECODER_COUNT);
|
||||
mResources.Put(static_cast<uint32_t>(MediaSystemResourceType::VIDEO_DECODER), resource);
|
||||
|
||||
resource = new MediaSystemResource(VIDEO_ENCODER_COUNT);
|
||||
mResources.Put(static_cast<uint32_t>(MediaSystemResourceType::VIDEO_ENCODER), resource);
|
||||
#endif
|
||||
}
|
||||
|
||||
MediaSystemResourceService::~MediaSystemResourceService()
|
||||
|
|
|
|||
|
|
@ -325,7 +325,7 @@ MediaEngineCameraVideoSource::SetName(nsString aName)
|
|||
VideoFacingModeEnum facingMode = VideoFacingModeEnum::User;
|
||||
|
||||
// Set facing mode based on device name.
|
||||
#if defined(ANDROID) && !defined(MOZ_WIDGET_GONK)
|
||||
#if defined(ANDROID)
|
||||
// Names are generated. Example: "Camera 0, Facing back, Orientation 90"
|
||||
//
|
||||
// See media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ MediaEngineDefaultVideoSource::Start(SourceMediaStream* aStream, TrackID aID,
|
|||
mTrackID = aID;
|
||||
|
||||
// Start timer for subsequent frames
|
||||
#if (defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID)) && defined(DEBUG)
|
||||
#if defined(MOZ_WIDGET_ANDROID) && defined(DEBUG)
|
||||
// emulator debug is very, very slow and has problems dealing with realtime audio inputs
|
||||
mTimer->InitWithCallback(this, (1000 / mOpts.mFPS)*10, nsITimer::TYPE_REPEATING_SLACK);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ MediaEngineWebRTC::EnumerateAudioDevices(dom::MediaSourceEnum aMediaSource,
|
|||
int nDevices = 0;
|
||||
mAudioInput->GetNumOfRecordingDevices(nDevices);
|
||||
int i;
|
||||
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
i = 0; // Bug 1037025 - let the OS handle defaulting for now on android/b2g
|
||||
#else
|
||||
// -1 is "default communications device" depending on OS in webrtc.org code
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue