Skip to content

Commit

Permalink
Merge mozilla-central and inbound
Browse files Browse the repository at this point in the history
  • Loading branch information
Ed Morley committed Apr 29, 2014
2 parents 88db1d4 + f0d0dea commit 9105d85
Show file tree
Hide file tree
Showing 140 changed files with 3,320 additions and 1,385 deletions.
1 change: 1 addition & 0 deletions accessible/tests/mochitest/jsat/test_gesture_tracker.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
gestures.forEach(AccessFuTest.addSequence);
AccessFuTest.addFunc(stopGestureTracker);
AccessFuTest.waitForExplicitFinish();
Logger.logLevel = Logger.DEBUG;
AccessFuTest.runTests();
});
}
Expand Down
11 changes: 3 additions & 8 deletions b2g/app/b2g.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ pref("browser.search.suggest.enabled", true);
// tell the search service that we don't really expose the "current engine"
pref("browser.search.noCurrentEngine", true);

// Enable sparse localization by setting a few package locale overrides
pref("chrome.override_package.global", "b2g-l10n");
pref("chrome.override_package.mozapps", "b2g-l10n");
pref("chrome.override_package.passwordmgr", "b2g-l10n");

// enable xul error pages
pref("browser.xul.error_pages.enabled", true);

Expand Down Expand Up @@ -899,9 +894,9 @@ pref("osfile.reset_worker_delay", 5000);
pref("apz.asyncscroll.throttle", 40);
pref("apz.pan_repaint_interval", 16);

// Maximum fling velocity in inches/ms. Slower devices may need to reduce this
// to avoid checkerboarding. Note, float value must be set as a string.
pref("apz.max_velocity_inches_per_ms", "0.0375");
// APZ physics settings, tuned by UX designers
pref("apz.max_velocity_inches_per_ms", "0.07");
pref("apz.fling_friction", "0.003");

// Tweak default displayport values to reduce the risk of running out of
// memory when zooming in
Expand Down
5 changes: 5 additions & 0 deletions b2g/locales/en-US/b2g-l10n.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
#filter substitution

pref("general.useragent.locale", "@AB_CD@");

// Enable sparse localization by setting a few package locale overrides
pref("chrome.override_package.global", "b2g-l10n");
pref("chrome.override_package.mozapps", "b2g-l10n");
pref("chrome.override_package.passwordmgr", "b2g-l10n");
Binary file modified build/pgo/certs/cert8.db
Binary file not shown.
Binary file modified build/pgo/certs/key3.db
Binary file not shown.
2 changes: 2 additions & 0 deletions build/pgo/server-locations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,5 @@ http://example.cn:80 privileged
http://example.co.jp:80 privileged
http://example.fi:80 privileged

# Hosts for testing marketplace apps installations
https://marketplace.firefox.com:443 privileged
12 changes: 0 additions & 12 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -5964,18 +5964,6 @@ if test "$MOZ_GAMEPAD"; then
MOZ_GAMEPAD_BACKEND=cocoa
;;
WINNT)
if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
MOZ_GAMEPAD=
fi
elif test "$GCC" != "yes"; then
MOZ_GAMEPAD=
fi
fi
if test -z "$MOZ_GAMEPAD"; then
AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
fi
MOZ_GAMEPAD_BACKEND=windows
;;
Linux)
Expand Down
2 changes: 1 addition & 1 deletion content/base/src/nsObjectLoadingContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3209,7 +3209,7 @@ nsObjectLoadingContent::LegacyCall(JSContext* aCx,
}

for (size_t i = 0; i < args.length(); i++) {
if (!JS_WrapValue(aCx, args.handleAt(i))) {
if (!JS_WrapValue(aCx, args[i])) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return JS::UndefinedValue();
}
Expand Down
26 changes: 13 additions & 13 deletions content/media/BufferDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@ class BufferDecoder : public AbstractMediaDecoder

virtual ReentrantMonitor& GetReentrantMonitor() MOZ_OVERRIDE;

virtual bool IsShutdown() const MOZ_FINAL MOZ_OVERRIDE;
virtual bool IsShutdown() const MOZ_OVERRIDE;

virtual bool OnStateMachineThread() const MOZ_OVERRIDE;

virtual bool OnDecodeThread() const MOZ_OVERRIDE;

virtual MediaResource* GetResource() const MOZ_OVERRIDE;

virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_FINAL MOZ_OVERRIDE;
virtual void NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) MOZ_OVERRIDE;

virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) MOZ_FINAL MOZ_OVERRIDE;
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) MOZ_OVERRIDE;

virtual int64_t GetEndMediaTime() const MOZ_FINAL MOZ_OVERRIDE;
virtual int64_t GetEndMediaTime() const MOZ_OVERRIDE;

virtual int64_t GetMediaDuration() MOZ_OVERRIDE;

Expand All @@ -56,25 +56,25 @@ class BufferDecoder : public AbstractMediaDecoder

virtual void SetTransportSeekable(bool aTransportSeekable) MOZ_OVERRIDE;

virtual VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE;
virtual VideoFrameContainer* GetVideoFrameContainer() MOZ_OVERRIDE;
virtual layers::ImageContainer* GetImageContainer() MOZ_OVERRIDE;

virtual bool IsTransportSeekable() MOZ_FINAL MOZ_OVERRIDE;
virtual bool IsTransportSeekable() MOZ_OVERRIDE;

virtual bool IsMediaSeekable() MOZ_FINAL MOZ_OVERRIDE;
virtual bool IsMediaSeekable() MOZ_OVERRIDE;

virtual void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
virtual void QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_FINAL MOZ_OVERRIDE;
virtual void MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_OVERRIDE;
virtual void QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) MOZ_OVERRIDE;

virtual void SetMediaEndTime(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
virtual void SetMediaEndTime(int64_t aTime) MOZ_OVERRIDE;

virtual void UpdatePlaybackPosition(int64_t aTime) MOZ_FINAL MOZ_OVERRIDE;
virtual void UpdatePlaybackPosition(int64_t aTime) MOZ_OVERRIDE;

virtual void OnReadMetadataCompleted() MOZ_FINAL MOZ_OVERRIDE;
virtual void OnReadMetadataCompleted() MOZ_OVERRIDE;

virtual MediaDecoderOwner* GetOwner() MOZ_OVERRIDE;

virtual void NotifyWaitingForResourcesStatusChanged() MOZ_FINAL MOZ_OVERRIDE;
virtual void NotifyWaitingForResourcesStatusChanged() MOZ_OVERRIDE;

protected:
// This monitor object is not really used to synchronize access to anything.
Expand Down
8 changes: 8 additions & 0 deletions content/media/encoder/TrackEncoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ VideoTrackEncoder::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph,
if (!chunk.IsNull()) {
gfx::IntSize imgsize = chunk.mFrame.GetImage()->GetSize();
gfxIntSize intrinsicSize = chunk.mFrame.GetIntrinsicSize();
#ifdef MOZ_WIDGET_GONK
// Block the video frames come from video source.
if (chunk.mFrame.GetImage()->GetFormat() != ImageFormat::PLANAR_YCBCR) {
LOG("Can't encode this ImageFormat %x", chunk.mFrame.GetImage()->GetFormat());
NotifyCancel();
break;
}
#endif
nsresult rv = Init(imgsize.width, imgsize.height,
intrinsicSize.width, intrinsicSize.height,
aTrackRate);
Expand Down
11 changes: 7 additions & 4 deletions content/media/mediasource/MediaSourceDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class MediaSourceReader : public MediaDecoderReader
return false;
}

MaybeSwitchVideoReaders(aTimeThreshold);
if (MaybeSwitchVideoReaders(aTimeThreshold)) {
GetVideoReader()->DecodeToTarget(aTimeThreshold);
}

bool rv = GetVideoReader()->DecodeVideoFrame(aKeyFrameSkip, aTimeThreshold);

Expand Down Expand Up @@ -129,7 +131,7 @@ class MediaSourceReader : public MediaDecoderReader
void CallDecoderInitialization();

private:
void MaybeSwitchVideoReaders(int64_t aTimeThreshold) {
bool MaybeSwitchVideoReaders(int64_t aTimeThreshold) {
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
MOZ_ASSERT(mActiveVideoDecoder != -1);

Expand All @@ -146,10 +148,11 @@ class MediaSourceReader : public MediaDecoderReader
MSE_DEBUG("%p MSR::DecodeVF switching to %d", this, mActiveVideoDecoder);

GetVideoReader()->SetActive();
GetVideoReader()->DecodeToTarget(aTimeThreshold);
break;
return true;
}
}

return false;
}

MediaDecoderReader* GetAudioReader() {
Expand Down
88 changes: 46 additions & 42 deletions content/media/mediasource/SourceBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ SubBufferDecoder::GetResource() const
return static_cast<SourceBufferResource*>(mResource.get());
}

void
SubBufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded)
{
return mParentDecoder->NotifyDecodedFrames(aParsed, aDecoded);
}

void
SubBufferDecoder::SetMediaDuration(int64_t aDuration)
{
Expand Down Expand Up @@ -192,12 +198,8 @@ SourceBuffer::GetBuffered(ErrorResult& aRv)
return nullptr;
}
nsRefPtr<TimeRanges> ranges = new TimeRanges();
for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
nsRefPtr<TimeRanges> r = new TimeRanges();
mDecoders[i]->GetBuffered(r);
if (r->Length() > 0) {
ranges->Add(r->GetStartTime(), r->GetEndTime());
}
if (mDecoder) {
mDecoder->GetBuffered(ranges);
}
ranges->Normalize();
return ranges.forget();
Expand Down Expand Up @@ -264,10 +266,10 @@ SourceBuffer::Abort(ErrorResult& aRv)
mAppendWindowStart = 0;
mAppendWindowEnd = PositiveInfinity<double>();

MSE_DEBUG("%p Abort: Discarding decoders.", this);
if (mCurrentDecoder) {
mCurrentDecoder->GetResource()->Ended();
mCurrentDecoder = nullptr;
MSE_DEBUG("%p Abort: Discarding decoder.", this);
if (mDecoder) {
mDecoder->GetResource()->Ended();
mDecoder = nullptr;
}
}

Expand All @@ -294,16 +296,15 @@ void
SourceBuffer::Detach()
{
Ended();
mDecoders.Clear();
mCurrentDecoder = nullptr;
mDecoder = nullptr;
mMediaSource = nullptr;
}

void
SourceBuffer::Ended()
{
for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
mDecoders[i]->GetResource()->Ended();
if (mDecoder) {
mDecoder->GetResource()->Ended();
}
}

Expand All @@ -316,6 +317,7 @@ SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
, mTimestampOffset(0)
, mAppendMode(SourceBufferAppendMode::Segments)
, mUpdating(false)
, mDecoderInit(false)
{
MOZ_ASSERT(aMediaSource);
if (mType.EqualsIgnoreCase("video/webm") || mType.EqualsIgnoreCase("audio/webm")) {
Expand All @@ -324,6 +326,8 @@ SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
// XXX: Plug in parsers for MPEG4, etc. here.
mParser = new ContainerParser();
}
MSE_DEBUG("%p SourceBuffer: Creating initial decoder.", this);
InitNewDecoder();
}

already_AddRefed<SourceBuffer>
Expand All @@ -335,8 +339,8 @@ SourceBuffer::Create(MediaSource* aMediaSource, const nsACString& aType)

SourceBuffer::~SourceBuffer()
{
for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
mDecoders[i]->GetResource()->Ended();
if (mDecoder) {
mDecoder->GetResource()->Ended();
}
}

Expand Down Expand Up @@ -375,11 +379,7 @@ SourceBuffer::InitNewDecoder()
if (!decoder) {
return false;
}
mDecoders.AppendElement(decoder);
// XXX: At this point, we really want to push through any remaining
// processing for the old decoder and discard it, rather than hanging on
// to all of them in mDecoders.
mCurrentDecoder = decoder;
mDecoder = decoder;
return true;
}

Expand Down Expand Up @@ -424,29 +424,32 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
// TODO: Test buffer full flag.
StartUpdating();
// TODO: Run buffer append algorithm asynchronously (would call StopUpdating()).
if (mParser->IsInitSegmentPresent(aData, aLength) || !mCurrentDecoder) {
MSE_DEBUG("%p AppendBuffer: New initialization segment, switching decoders.", this);
if (mCurrentDecoder) {
mCurrentDecoder->GetResource()->Ended();
}
if (!InitNewDecoder()) {
aRv.Throw(NS_ERROR_FAILURE); // XXX: Review error handling.
return;
if (!mDecoder || mParser->IsInitSegmentPresent(aData, aLength)) {
if (!mDecoder || mDecoderInit) {
MSE_DEBUG("%p AppendBuffer: New initialization segment, creating decoder.", this);
mDecoder->GetResource()->Ended();

if (!InitNewDecoder()) {
aRv.Throw(NS_ERROR_FAILURE); // XXX: Review error handling.
return;
}
}
MSE_DEBUG("%p AppendBuffer: Decoder marked as initialized.", this);
mDecoderInit = true;
}
// XXX: For future reference: NDA call must run on the main thread.
mCurrentDecoder->NotifyDataArrived(reinterpret_cast<const char*>(aData),
aLength,
mCurrentDecoder->GetResource()->GetLength());
mCurrentDecoder->GetResource()->AppendData(aData, aLength);
mDecoder->NotifyDataArrived(reinterpret_cast<const char*>(aData),
aLength,
mDecoder->GetResource()->GetLength());
mDecoder->GetResource()->AppendData(aData, aLength);

// Eviction uses a byte threshold. If the buffer is greater than the
// number of bytes then data is evicted. The time range for this
// eviction is reported back to the media source. It will then
// evict data before that range across all SourceBuffer's it knows
// about.
const int evict_threshold = 1000000;
bool evicted = mCurrentDecoder->GetResource()->EvictData(evict_threshold);
bool evicted = mDecoder->GetResource()->EvictData(evict_threshold);
if (evicted) {
double start = 0.0;
double end = 0.0;
Expand Down Expand Up @@ -479,14 +482,15 @@ SourceBuffer::GetBufferedStartEndTime(double* aStart, double* aEnd)
void
SourceBuffer::Evict(double aStart, double aEnd)
{
for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
// Need to map time to byte offset then evict
int64_t end = mDecoders[i]->ConvertToByteOffset(aEnd);
if (end <= 0) {
NS_WARNING("SourceBuffer::Evict failed");
continue;
}
mDecoders[i]->GetResource()->EvictBefore(end);
if (!mDecoder) {
return;
}
// Need to map time to byte offset then evict
int64_t end = mDecoder->ConvertToByteOffset(aEnd);
if (end > 0) {
mDecoder->GetResource()->EvictBefore(end);
} else {
NS_WARNING("SourceBuffer::Evict failed");
}
}

Expand Down
7 changes: 3 additions & 4 deletions content/media/mediasource/SourceBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ class SourceBuffer MOZ_FINAL : public DOMEventTargetHelper

nsAutoPtr<ContainerParser> mParser;

// XXX: We only want to keep the current decoder alive, but need a way to
// query @buffered for everything this SourceBuffer is responsible for.
nsTArray<nsRefPtr<SubBufferDecoder>> mDecoders;
nsRefPtr<SubBufferDecoder> mCurrentDecoder;
nsRefPtr<SubBufferDecoder> mDecoder;

double mAppendWindowStart;
double mAppendWindowEnd;
Expand All @@ -152,6 +149,8 @@ class SourceBuffer MOZ_FINAL : public DOMEventTargetHelper

SourceBufferAppendMode mAppendMode;
bool mUpdating;

bool mDecoderInit;
};

} // namespace dom
Expand Down
1 change: 1 addition & 0 deletions content/media/mediasource/SubBufferDecoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SubBufferDecoder : public BufferDecoder
virtual bool OnStateMachineThread() const MOZ_OVERRIDE;
virtual bool OnDecodeThread() const MOZ_OVERRIDE;
virtual SourceBufferResource* GetResource() const MOZ_OVERRIDE;
virtual void NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) MOZ_OVERRIDE;
virtual void SetMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
virtual void UpdateEstimatedMediaDuration(int64_t aDuration) MOZ_OVERRIDE;
virtual void SetMediaSeekable(bool aMediaSeekable) MOZ_OVERRIDE;
Expand Down
Loading

0 comments on commit 9105d85

Please sign in to comment.