Skip to content

Commit

Permalink
Merge b2g-inbound to m-c
Browse files Browse the repository at this point in the history
  • Loading branch information
KWierso committed Jan 14, 2014
2 parents 7847788 + 7fed521 commit 073cad9
Show file tree
Hide file tree
Showing 25 changed files with 129 additions and 238 deletions.
2 changes: 1 addition & 1 deletion b2g/config/gaia.json
@@ -1,4 +1,4 @@
{
"revision": "c8716b0dcb8cc8946903355c3533481f967b52d3",
"revision": "5fed274e799a9f111cdf6476ec53c9328c55c7b9",
"repo_path": "/integration/gaia-central"
}
4 changes: 2 additions & 2 deletions b2g/config/hamachi/releng-hamachi.tt
@@ -1,7 +1,7 @@
[
{
"size": 55073212,
"digest": "10560463c0804186fc59a84ecab4d5ccd1ffdf298336d3b91065c38888698f4cfab4bad743d6170e73f9bc0538f47a96baf5f1381e8b4ab484d8721301bea31e",
"size": 55276112,
"digest": "035efc2064a88bdb6f60fd126f17ee0e35de708f4666837cbeb0f3381024044a6ec3a05c244c553f9c2d852d94706f5263edde3d7dbff33872bd05db0215f5e6",
"algorithm": "sha512",
"filename": "backup-hamachi.tar.xz"
},
Expand Down
4 changes: 2 additions & 2 deletions b2g/config/hamachi/releng-limited-memory.tt
@@ -1,7 +1,7 @@
[
{
"size": 55073212,
"digest": "10560463c0804186fc59a84ecab4d5ccd1ffdf298336d3b91065c38888698f4cfab4bad743d6170e73f9bc0538f47a96baf5f1381e8b4ab484d8721301bea31e",
"size": 55276112,
"digest": "035efc2064a88bdb6f60fd126f17ee0e35de708f4666837cbeb0f3381024044a6ec3a05c244c553f9c2d852d94706f5263edde3d7dbff33872bd05db0215f5e6",
"algorithm": "sha512",
"filename": "backup-hamachi.tar.xz"
},
Expand Down
Expand Up @@ -26,7 +26,7 @@
sessionToken: "dead",
kA: "beef",
kB: "cafe",
isVerified: true
verified: true
},
payloadType: "message",
validateResponse: function(payload) {
Expand Down
6 changes: 3 additions & 3 deletions content/media/encoder/fmp4_muxer/ISOMediaBoxes.cpp
Expand Up @@ -456,7 +456,7 @@ MovieExtendsBox::~MovieExtendsBox()
nsresult
ChunkOffsetBox::Generate(uint32_t* aBoxSize)
{
// fragmented, we don't need time to sample table
// We don't need time to sample table in fragmented mp4.
entry_count = 0;
size += sizeof(entry_count);
*aBoxSize = size;
Expand Down Expand Up @@ -486,7 +486,7 @@ ChunkOffsetBox::~ChunkOffsetBox()
nsresult
SampleToChunkBox::Generate(uint32_t* aBoxSize)
{
// fragmented, we don't need time to sample table
// We don't need time to sample table in fragmented mp4
entry_count = 0;
size += sizeof(entry_count);
*aBoxSize = size;
Expand Down Expand Up @@ -516,7 +516,7 @@ SampleToChunkBox::~SampleToChunkBox()
nsresult
TimeToSampleBox::Generate(uint32_t* aBoxSize)
{
// fragmented, we don't need time to sample table
// We don't need time to sample table in fragmented mp4.
entry_count = 0;
size += sizeof(entry_count);
*aBoxSize = size;
Expand Down
6 changes: 6 additions & 0 deletions content/media/encoder/fmp4_muxer/ISOMediaBoxes.h
Expand Up @@ -20,6 +20,12 @@

namespace mozilla {

/**
* track type from spec 8.4.3.3
*/
#define Audio_Track 0x01
#define Video_Track 0x02

class AACTrackMetadata;
class AVCTrackMetadata;
class ES_Descriptor;
Expand Down
3 changes: 1 addition & 2 deletions content/media/encoder/fmp4_muxer/ISOMediaWriter.cpp
Expand Up @@ -28,7 +28,6 @@ ISOMediaWriter::ISOMediaWriter(uint32_t aType)
, mBlobReady(false)
, mType(0)
{
// TODO: replace Audio_Track/Video_Track with HAS_AUDIO/HAS_VIDEO
if (aType & HAS_AUDIO) {
mType |= Audio_Track;
}
Expand Down Expand Up @@ -176,7 +175,7 @@ ISOMediaWriter::ReadyToRunState(bool& aEOS)
if (!mVideoFragmentBuffer->HasEnoughData()) {
bReadyToMux = false;
}
if (mAudioFragmentBuffer->EOS()) {
if (mVideoFragmentBuffer->EOS()) {
aEOS = true;
bReadyToMux = true;
}
Expand Down
2 changes: 1 addition & 1 deletion content/media/encoder/fmp4_muxer/ISOMediaWriter.h
Expand Up @@ -81,7 +81,7 @@ class ISOMediaWriter : public ContainerWriter
// A flag to indicate the output buffer is ready to blob out.
bool mBlobReady;

// Combination of HAS_AUDIO or HAS_VIDEO.
// Combination of Audio_Track or Video_Track.
uint32_t mType;
};

Expand Down
6 changes: 0 additions & 6 deletions content/media/encoder/fmp4_muxer/ISOTrackMetadata.h
Expand Up @@ -10,12 +10,6 @@

namespace mozilla {

/**
* track type from spec 8.4.3.3
*/
#define Audio_Track 0x01
#define Video_Track 0x02

class AACTrackMetadata : public TrackMetadataBase {
public:
uint32_t SampleRate; // From 14496-3 table 1.16, it could be 7350 ~ 96000.
Expand Down
43 changes: 43 additions & 0 deletions dom/downloads/tests/serve_file.sjs
Expand Up @@ -53,8 +53,14 @@ function handleResponse() {
function handleRequest(request, response) {
var query = getQuery(request);

// Default status when responding.
var version = "1.1";
var statusCode = 200;
var description = "OK";

// Default values for content type, size and rate.
var contentType = "text/plain";
var contentRange = null;
var size = 1024;
var rate = 0;

Expand All @@ -68,6 +74,39 @@ function handleRequest(request, response) {
size = parseInt(query["size"]);
}

// optional range request check.
if (request.hasHeader("range")) {
version = "1.1";
statusCode = 206;
description = "Partial Content";

// We'll only support simple range byte style requests.
var [offset, total] = request.getHeader("range").slice("bytes=".length).split("-");
// Enforce valid Number values.
offset = parseInt(offset);
offset = isNaN(offset) ? 0 : offset;
// Same.
total = parseInt(total);
total = isNaN(total) ? 0 : total;

// We'll need to original total size as part of the Content-Range header
// value in our response.
var originalSize = size;

// If we have a total size requested, we must make sure to send that number
// of bytes only (minus the start offset).
if (total && total < size) {
size = total - offset;
} else if (offset) {
// Looks like we just have a byte offset to deal with.
size = size - offset;
}

// We specifically need to add a Content-Range header to all responses for
// requests that include a range request header.
contentRange = "bytes " + offset + "-" + (size - 1) + "/" + originalSize;
}

// optional rate (in bytes/s) at which to send the file.
if ("rate" in query) {
rate = parseInt(query["rate"]);
Expand Down Expand Up @@ -96,7 +135,11 @@ function handleRequest(request, response) {
response.processAsync();

// generate the content.
response.setStatusLine(version, statusCode, description);
response.setHeader("Content-Type", contentType, false);
if (contentRange) {
response.setHeader("Content-Range", contentRange, false);
}
response.setHeader("Content-Length", size.toString(), false);

// initialize the timer and start writing out the response.
Expand Down
11 changes: 5 additions & 6 deletions dom/downloads/tests/test_downloads_pause_resume.html
Expand Up @@ -15,7 +15,7 @@
<p id="display"></p>
<div id="content" style="display: none">
</div>
<a href="serve_file.sjs?contentType=application/octet-stream&size=102400&rate=1024" download="test.bin" id="download1">Large Download</a>
<a href="serve_file.sjs?contentType=application/octet-stream&size=102400&rate=10240" download="test.bin" id="download1">Large Download</a>
<pre id="test">
<script class="testbody" type="text/javascript;version=1.7">

Expand Down Expand Up @@ -52,10 +52,10 @@
SimpleTest.finish();
}

function checkResumedFailed(download) {
ok(download.state == "stopped", "Download fails to resume.");
function checkResumeSucceeded(download) {
ok(download.state == "succeeded", "Download resumed successfully.");
navigator.mozDownloadManager.clearAllDone()
.then(checkDownloadList, error);
.then(checkDownloadList, error);
}

function downloadChange(evt) {
Expand All @@ -67,9 +67,8 @@
} else if (download.state == "stopped" && !resuming) {
resuming = true;
ok(pausing, "Download stopped by pause()");
// serve_file.sjs does not support resuming, so that should fail.
download.resume()
.then(error, function() { checkResumedFailed(download); });
.then(function() { checkResumeSucceeded(download); }, error);
}
}

Expand Down
97 changes: 10 additions & 87 deletions dom/fmradio/FMRadioService.cpp
Expand Up @@ -24,9 +24,6 @@
#define CHANNEL_WIDTH_100KHZ 100
#define CHANNEL_WIDTH_50KHZ 50

#define MOZSETTINGS_CHANGED_ID "mozsettings-changed"
#define SETTING_KEY_RIL_RADIO_DISABLED "ril.radio.disabled"

using namespace mozilla::hal;
using mozilla::Preferences;

Expand Down Expand Up @@ -93,12 +90,6 @@ FMRadioService::FMRadioService()

nsCOMPtr<nsIObserverService> obs = services::GetObserverService();

if (NS_FAILED(obs->AddObserver(this,
MOZSETTINGS_CHANGED_ID,
/* useWeak */ false))) {
NS_WARNING("Failed to add settings change observer!");
}

RegisterFMRadioObserver(this);
}

Expand Down Expand Up @@ -446,7 +437,7 @@ FMRadioService::Enable(double aFrequencyInMHz,
nsRefPtr<ReadRilSettingTask> callback =
new ReadRilSettingTask(mPendingRequest);

rv = settingsLock->Get(SETTING_KEY_RIL_RADIO_DISABLED, callback);
rv = settingsLock->Get("ril.radio.disabled", callback);
if (NS_FAILED(rv)) {
TransitionState(ErrorResponse(
NS_LITERAL_STRING("Can't get settings lock")), Disabled);
Expand All @@ -463,25 +454,18 @@ FMRadioService::Enable(double aFrequencyInMHz,
void
FMRadioService::Disable(FMRadioReplyRunnable* aReplyRunnable)
{
// When airplane-mode is enabled, we will call this function from
// FMRadioService::Observe without passing a FMRadioReplyRunnable,
// so we have to check if |aReplyRunnable| is null before we dispatch it.
MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!");

switch (mState) {
case Disabling:
if (aReplyRunnable) {
aReplyRunnable->SetReply(
ErrorResponse(NS_LITERAL_STRING("FM radio currently disabling")));
NS_DispatchToMainThread(aReplyRunnable);
}
aReplyRunnable->SetReply(
ErrorResponse(NS_LITERAL_STRING("FM radio currently disabling")));
NS_DispatchToMainThread(aReplyRunnable);
return;
case Disabled:
if (aReplyRunnable) {
aReplyRunnable->SetReply(
ErrorResponse(NS_LITERAL_STRING("FM radio currently disabled")));
NS_DispatchToMainThread(aReplyRunnable);
}
aReplyRunnable->SetReply(
ErrorResponse(NS_LITERAL_STRING("FM radio currently disabled")));
NS_DispatchToMainThread(aReplyRunnable);
return;
case Enabled:
case Enabling:
Expand Down Expand Up @@ -515,10 +499,8 @@ FMRadioService::Disable(FMRadioReplyRunnable* aReplyRunnable)
if (!mHasReadRilSetting) {
SetState(Disabled);

if (aReplyRunnable) {
aReplyRunnable->SetReply(SuccessResponse());
NS_DispatchToMainThread(aReplyRunnable);
}
aReplyRunnable->SetReply(SuccessResponse());
NS_DispatchToMainThread(aReplyRunnable);
}

return;
Expand Down Expand Up @@ -649,65 +631,6 @@ FMRadioService::CancelSeek(FMRadioReplyRunnable* aReplyRunnable)
NS_DispatchToMainThread(aReplyRunnable);
}

NS_IMETHODIMP
FMRadioService::Observe(nsISupports * aSubject,
const char * aTopic,
const char16_t * aData)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(sFMRadioService);

if (strcmp(aTopic, MOZSETTINGS_CHANGED_ID) != 0) {
return NS_OK;
}

// The string that we're interested in will be a JSON string looks like:
// {"key":"ril.radio.disabled","value":true}
AutoSafeJSContext cx;
const nsDependentString dataStr(aData);
JS::Rooted<JS::Value> val(cx);
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
!val.isObject()) {
return NS_OK;
}

JSObject& obj(val.toObject());
JS::Rooted<JS::Value> key(cx);
if (!JS_GetProperty(cx, &obj, "key", &key) ||
!key.isString()) {
return NS_OK;
}

JS::Rooted<JSString*> jsKey(cx, key.toString());
nsDependentJSString keyStr;
if (!keyStr.init(cx, jsKey)) {
return NS_OK;
}

JS::Rooted<JS::Value> value(cx);
if (!JS_GetProperty(cx, &obj, "value", &value)) {
return NS_OK;
}

if (keyStr.EqualsLiteral(SETTING_KEY_RIL_RADIO_DISABLED)) {
if (!value.isBoolean()) {
return NS_OK;
}

mRilDisabled = value.toBoolean();
mHasReadRilSetting = true;

// Disable the FM radio HW if Airplane mode is enabled.
if (mRilDisabled) {
Disable(nullptr);
}

return NS_OK;
}

return NS_OK;
}

void
FMRadioService::NotifyFMRadioEvent(FMRadioEventType aType)
{
Expand Down Expand Up @@ -809,7 +732,7 @@ FMRadioService::Singleton()
return sFMRadioService;
}

NS_IMPL_ISUPPORTS1(FMRadioService, nsIObserver)
NS_IMPL_ISUPPORTS0(FMRadioService)

END_FMRADIO_NAMESPACE

5 changes: 1 addition & 4 deletions dom/fmradio/FMRadioService.h
Expand Up @@ -13,7 +13,6 @@
#include "mozilla/StaticPtr.h"
#include "mozilla/Services.h"
#include "nsThreadUtils.h"
#include "nsIObserver.h"
#include "nsXULAppAPI.h"

BEGIN_FMRADIO_NAMESPACE
Expand Down Expand Up @@ -137,8 +136,8 @@ enum FMRadioState
};

class FMRadioService MOZ_FINAL : public IFMRadioService
, public nsISupports
, public hal::FMRadioObserver
, public nsIObserver
{
friend class ReadRilSettingTask;
friend class SetFrequencyRunnable;
Expand Down Expand Up @@ -172,8 +171,6 @@ class FMRadioService MOZ_FINAL : public IFMRadioService
/* FMRadioObserver */
void Notify(const hal::FMRadioOperationInformation& aInfo) MOZ_OVERRIDE;

NS_DECL_NSIOBSERVER

protected:
FMRadioService();

Expand Down
1 change: 0 additions & 1 deletion dom/fmradio/test/marionette/manifest.ini
Expand Up @@ -10,5 +10,4 @@ qemu = false
[test_one_seek_at_once.js]
[test_seek_up_and_down.js]
[test_bug862672.js]
[test_bug876597.js]

0 comments on commit 073cad9

Please sign in to comment.