mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:30:27 +00:00
aa93536920
- Bug 1208300 (part 1) - Remove unused default arguments from ClearThebesSurface. r=jwatt. (bcb2009a23) - Bug 1208300 (part 2) - Convert gfxRGBA uses to gfx::Color in CompositorBench.cpp. r=jwatt. (ea9b6e5e4e) - Bug 1208300 (part 3) - Convert gfxRGBA uses to gfx::Color in LayerScope.cpp. r=jwatt. (cdee85cd56) - Bg 1155249 - Prescale image with an intermediate surface if repeated often on OS X. r=mstange (de799a164a) - Bug 1181554 - Snap the spread radius for inset box shadows to device pixels. (af015ea088) - Bug 1137148. Fix painting of ridge/groove borders for border-collapsed tables. r=jwatt (702e4fbe9b) - Bug 1185636 - Part 4b - don't use a css border skirt when printing. r=mstange (2e66f01772) - Bug 1178575 - Intersect the clip rect with aDirtyRect. r=roc (88848e836a) - Bug 1193519 pt 1 - Update coordinate conversions in WritingModes.h to account for sideways-lr writing mode. r=dholbert (b89824bcb6) - Bug 1193519 pt 2 - Handle sideways-left orientation in gfx text-drawing code. r=dholbert (4cdc8e0c38) - Bug 1193519 pt 3 - Handle writing-mode:sideways-lr in nsTextFrame selection and rendering. r=dholbert (b774d26992) - Bug 1159729 - Use the adjusted |offset| value in GetTextDecorationRectInternal, instead of ignoring it. r=smontagu (b1c735a0b0) - Bug 1193519 pt 4 - Reverse the direction of text-decoration offsets in sideways-lr mode. r=dholbert (585bcf555a) - Bug 1205787 - Map the writing-mode values from SVG1.1 to their CSS equivalents. r=heycam (dd8e0d9767) - Bug 1193488 - Update values of writing-mode and text-orientation to reflect the CSS WG decision to revise them in the Writing Modes spec. r=dholbert (4399949445) - Bug 1193519 pt 5 - Expose the sideways-lr value for writing-mode to CSS. r=dholbert (ece6e331d1) - Bug 1193519 pt 6 - Adjust the position of the caret bidi indicator appropriately for sideways-lr mode. r=dholbert (b09478c428) - Bug 1205787 - Reftest using legacy SVG1.1 writing-mode values. r=heycam (062df44279) - Bug 1193519 pt 7 - Basic reftests for sideways-lr writing mode. r=dholbert (2c66b9e399) - Bug 1180528 - Reftest for table row progression in vertical-rl writing mode with ltr and rtl directionality. r=dholbert (e2a5c6cadb) - Bug 1193519 pt 8 - Reftests for table row and cell ordering in sideways-* writing modes. r=dholbert (6487fce57d) - Bug 1193519 pt 9 - Reftests with floats in writing-mode: sideways-lr. r=dholbert (9f51c048c6) - Bug 1193519 pt 10 - Clean up remaining mentions of 'sideways-left' in code comments. r=dholbert (8483886936) - Bug 1193519 pt 11 - Reftest for sideways-lr writing mode with text-decoration. r=dholbert (bcfd28b4e8) - Bug 1193519 followup - annotate test for antialiasing fuzz on OS X. (1b8a465d1f) - Bug 1155828 - Draw box-shadows using an approach inspired by border-image. r=mstange (744997a069) - Bug 1162824 - Change box shadow cache to cache the colored blurred box shadow. r=mstange (813107388f) - convert TemporaryRef to already_AddRefed (626bbcb2ec) - Bug 1179049. Properly null check for draw target in box shadow code. r=mstange (8f3c03253c) - Bug 1188075 - Speed up inner box-shadow drawing by using a border-image style approach. r=mstange (61e4564172) - Bug 1208345 - Remove gfxContext::GraphicsOperator. r=jwatt. (884be741db) - Bug 1199534. Only set TabChild canvas background for the background of root PresContexts. r=mats (9a37268f31) - remove special transparent case, not found in FF45/52 nor TFF (a2577d8a0c) - Bug 1202320 - Fall back to platform APZ enabled in PresShell. r=kats (5a62e3e058) - bug 1171131 - Make dom/plugins/ipc build for iOS. r=jimm (cba4193b6e) - Bug 1207741 - Remove gfxIntSize. r=nical. (13b99abb9c) - Bug 591600 - CSS gradients should work on premultiplied colors. r=mstange (b0c6e73961)
211 lines
5.6 KiB
C++
211 lines
5.6 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/
|
|
/* 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/. */
|
|
|
|
#include "CameraPreviewMediaStream.h"
|
|
#include "CameraCommon.h"
|
|
|
|
/**
|
|
* Maximum number of outstanding invalidates before we start to drop frames;
|
|
* if we hit this threshold, it is an indicator that the main thread is
|
|
* either very busy or the device is busy elsewhere (e.g. encoding or
|
|
* persisting video data).
|
|
*/
|
|
#define MAX_INVALIDATE_PENDING 4
|
|
|
|
using namespace mozilla::layers;
|
|
using namespace mozilla::dom;
|
|
|
|
namespace mozilla {
|
|
|
|
static const TrackID TRACK_VIDEO = 2;
|
|
|
|
void
|
|
FakeMediaStreamGraph::DispatchToMainThreadAfterStreamStateUpdate(already_AddRefed<nsIRunnable> aRunnable)
|
|
{
|
|
nsCOMPtr<nsIRunnable> task = aRunnable;
|
|
NS_DispatchToMainThread(task);
|
|
}
|
|
|
|
CameraPreviewMediaStream::CameraPreviewMediaStream(DOMMediaStream* aWrapper)
|
|
: MediaStream(aWrapper)
|
|
, mMutex("mozilla::camera::CameraPreviewMediaStream")
|
|
, mInvalidatePending(0)
|
|
, mDiscardedFrames(0)
|
|
, mRateLimit(false)
|
|
, mTrackCreated(false)
|
|
{
|
|
SetGraphImpl(
|
|
MediaStreamGraph::GetInstance(
|
|
MediaStreamGraph::SYSTEM_THREAD_DRIVER, AudioChannel::Normal));
|
|
mFakeMediaStreamGraph = new FakeMediaStreamGraph();
|
|
mIsConsumed = false;
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::AddAudioOutput(void* aKey)
|
|
{
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::SetAudioOutputVolume(void* aKey, float aVolume)
|
|
{
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::RemoveAudioOutput(void* aKey)
|
|
{
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::AddVideoOutput(VideoFrameContainer* aContainer)
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
nsRefPtr<VideoFrameContainer> container = aContainer;
|
|
AddVideoOutputImpl(container.forget());
|
|
|
|
if (mVideoOutputs.Length() > 1) {
|
|
return;
|
|
}
|
|
mIsConsumed = true;
|
|
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
|
|
MediaStreamListener* l = mListeners[j];
|
|
l->NotifyConsumptionChanged(mFakeMediaStreamGraph, MediaStreamListener::CONSUMED);
|
|
}
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::RemoveVideoOutput(VideoFrameContainer* aContainer)
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
RemoveVideoOutputImpl(aContainer);
|
|
|
|
if (!mVideoOutputs.IsEmpty()) {
|
|
return;
|
|
}
|
|
mIsConsumed = false;
|
|
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
|
|
MediaStreamListener* l = mListeners[j];
|
|
l->NotifyConsumptionChanged(mFakeMediaStreamGraph, MediaStreamListener::NOT_CONSUMED);
|
|
}
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::ChangeExplicitBlockerCount(int32_t aDelta)
|
|
{
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::AddListener(MediaStreamListener* aListener)
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
MediaStreamListener* listener = *mListeners.AppendElement() = aListener;
|
|
listener->NotifyBlockingChanged(mFakeMediaStreamGraph, MediaStreamListener::UNBLOCKED);
|
|
listener->NotifyHasCurrentData(mFakeMediaStreamGraph);
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::RemoveListener(MediaStreamListener* aListener)
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
nsRefPtr<MediaStreamListener> listener(aListener);
|
|
mListeners.RemoveElement(aListener);
|
|
listener->NotifyEvent(mFakeMediaStreamGraph, MediaStreamListener::EVENT_REMOVED);
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::OnPreviewStateChange(bool aActive)
|
|
{
|
|
if (aActive) {
|
|
MutexAutoLock lock(mMutex);
|
|
if (!mTrackCreated) {
|
|
mTrackCreated = true;
|
|
VideoSegment tmpSegment;
|
|
for (uint32_t j = 0; j < mListeners.Length(); ++j) {
|
|
MediaStreamListener* l = mListeners[j];
|
|
l->NotifyQueuedTrackChanges(mFakeMediaStreamGraph, TRACK_VIDEO, 0,
|
|
MediaStreamListener::TRACK_EVENT_CREATED,
|
|
tmpSegment);
|
|
l->NotifyFinishedTrackCreation(mFakeMediaStreamGraph);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::Destroy()
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
mMainThreadDestroyed = true;
|
|
DestroyImpl();
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::Invalidate()
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
--mInvalidatePending;
|
|
for (nsTArray<nsRefPtr<VideoFrameContainer> >::size_type i = 0; i < mVideoOutputs.Length(); ++i) {
|
|
VideoFrameContainer* output = mVideoOutputs[i];
|
|
output->Invalidate();
|
|
}
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::RateLimit(bool aLimit)
|
|
{
|
|
mRateLimit = aLimit;
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::SetCurrentFrame(const gfx::IntSize& aIntrinsicSize, Image* aImage)
|
|
{
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
if (mInvalidatePending > 0) {
|
|
if (mRateLimit || mInvalidatePending > MAX_INVALIDATE_PENDING) {
|
|
++mDiscardedFrames;
|
|
DOM_CAMERA_LOGW("Discard preview frame %d, %d invalidation(s) pending",
|
|
mDiscardedFrames, mInvalidatePending);
|
|
return;
|
|
}
|
|
|
|
DOM_CAMERA_LOGI("Update preview frame, %d invalidation(s) pending",
|
|
mInvalidatePending);
|
|
}
|
|
mDiscardedFrames = 0;
|
|
|
|
TimeStamp now = TimeStamp::Now();
|
|
for (nsTArray<nsRefPtr<VideoFrameContainer> >::size_type i = 0; i < mVideoOutputs.Length(); ++i) {
|
|
VideoFrameContainer* output = mVideoOutputs[i];
|
|
output->SetCurrentFrame(aIntrinsicSize, aImage, now);
|
|
}
|
|
|
|
++mInvalidatePending;
|
|
}
|
|
|
|
nsCOMPtr<nsIRunnable> event =
|
|
NS_NewRunnableMethod(this, &CameraPreviewMediaStream::Invalidate);
|
|
NS_DispatchToMainThread(event);
|
|
}
|
|
|
|
void
|
|
CameraPreviewMediaStream::ClearCurrentFrame()
|
|
{
|
|
MutexAutoLock lock(mMutex);
|
|
|
|
for (nsTArray<nsRefPtr<VideoFrameContainer> >::size_type i = 0; i < mVideoOutputs.Length(); ++i) {
|
|
VideoFrameContainer* output = mVideoOutputs[i];
|
|
output->ClearCurrentFrame();
|
|
nsCOMPtr<nsIRunnable> event =
|
|
NS_NewRunnableMethod(output, &VideoFrameContainer::Invalidate);
|
|
NS_DispatchToMainThread(event);
|
|
}
|
|
}
|
|
|
|
} // namespace mozilla
|