Merge mozilla-central and b2g-inbound

This commit is contained in:
Ed Morley 2013-11-12 15:11:34 +00:00
Родитель c15f5d7e0d 2e2e7bbe60
Коммит 98da2c262b
5 изменённых файлов: 42 добавлений и 28 удалений

Просмотреть файл

@ -1,4 +1,4 @@
{
"revision": "a4cf8ffc89dac77d44643fe527fd420f76ad663b",
"revision": "5208f7d41f2f2ce88b8f14908af1ae5f2d9d9052",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -23,8 +23,9 @@ NS_INTERFACE_MAP_END_INHERITING(AudioNode)
NS_IMPL_ADDREF_INHERITED(MediaStreamAudioDestinationNode, AudioNode)
NS_IMPL_RELEASE_INHERITED(MediaStreamAudioDestinationNode, AudioNode)
// This must be a different value than AUDIO_NODE_STREAM_TRACK_ID
static const int MEDIA_STREAM_DEST_TRACK_ID = 2;
static_assert(MEDIA_STREAM_DEST_TRACK_ID != AudioNodeStream::AUDIO_TRACK,
"MediaStreamAudioDestinationNode::MEDIA_STREAM_DEST_TRACK_ID must be a different value than AudioNodeStream::AUDIO_TRACK");
class MediaStreamDestinationEngine : public AudioNodeEngine {
public:

Просмотреть файл

@ -21,6 +21,7 @@
#include "plbase64.h"
#include "certdb.h"
#include "ScopedNSSTypes.h"
using namespace mozilla::ipc;
@ -327,7 +328,7 @@ KeyStore::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage)
const char *certName = (const char *)mHandlerInfo.param[0].data;
// Get cert from NSS by name
CERTCertificate *cert = CERT_FindCertByNickname(certdb, certName);
ScopedCERTCertificate cert(CERT_FindCertByNickname(certdb, certName));
if (!cert) {
break;
}

Просмотреть файл

@ -99,6 +99,8 @@ AMPEG4ElementaryAssembler::AMPEG4ElementaryAssembler(
mRandomAccessIndication(false),
mStreamStateIndication(0),
mAuxiliaryDataSizeLength(0),
mConstantDuration(0),
mPreviousAUCount(0),
mHasAUHeader(false),
mAccessUnitRTPTime(0),
mNextExpectedSeqNoValid(false),
@ -155,6 +157,12 @@ AMPEG4ElementaryAssembler::AMPEG4ElementaryAssembler(
mAuxiliaryDataSizeLength = 0;
}
if (!GetIntegerAttribute(
params.c_str(), "constantDuration",
&mConstantDuration)) {
mConstantDuration = 0;
}
mHasAUHeader =
mSizeLength > 0
|| mIndexLength > 0
@ -214,6 +222,14 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket(
if (mPackets.size() > 0 && rtpTime != mAccessUnitRTPTime) {
submitAccessUnit();
}
// If constantDuration and CTSDelta are not present. We should assume the
// stream has fixed duration and calculate the mConstantDuration.
if (!mConstantDuration && !mCTSDeltaLength && mPreviousAUCount
&& rtpTime > mAccessUnitRTPTime) {
mConstantDuration = (rtpTime - mAccessUnitRTPTime) / mPreviousAUCount;
}
mAccessUnitRTPTime = rtpTime;
if (!mIsGeneric) {
@ -309,10 +325,12 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket(
offset += (mAuxiliaryDataSizeLength + auxSize + 7) / 8;
}
mPreviousAUCount = 0;
for (List<AUHeader>::iterator it = headers.begin();
it != headers.end(); ++it) {
mPreviousAUCount++;
const AUHeader &header = *it;
const AUHeader &first = *headers.begin();
CHECK_LE(offset + header.mSize, buffer->size());
sp<ABuffer> accessUnit = new ABuffer(header.mSize);
@ -320,7 +338,11 @@ ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::addPacket(
offset += header.mSize;
CopyTimes(accessUnit, buffer);
int rtpTime = mAccessUnitRTPTime +
mConstantDuration * (header.mSerial - first.mSerial);
accessUnit->meta()->setInt32("rtp-time", rtpTime);
accessUnit->setInt32Data(buffer->int32Data());
mPackets.push_back(accessUnit);
}
@ -338,38 +360,24 @@ void AMPEG4ElementaryAssembler::submitAccessUnit() {
LOGV("Access unit complete (%d nal units)", mPackets.size());
size_t totalSize = 0;
for (List<sp<ABuffer> >::iterator it = mPackets.begin();
it != mPackets.end(); ++it) {
totalSize += (*it)->size();
}
sp<ABuffer> accessUnit = new ABuffer(totalSize);
size_t offset = 0;
for (List<sp<ABuffer> >::iterator it = mPackets.begin();
it != mPackets.end(); ++it) {
sp<ABuffer> accessUnit = new ABuffer((*it)->size());
sp<ABuffer> nal = *it;
memcpy(accessUnit->data() + offset, nal->data(), nal->size());
offset += nal->size();
}
memcpy(accessUnit->data(), nal->data(), nal->size());
CopyTimes(accessUnit, nal);
CopyTimes(accessUnit, *mPackets.begin());
if (mAccessUnitDamaged) {
accessUnit->meta()->setInt32("damaged", true);
}
#if 0
printf(mAccessUnitDamaged ? "X" : ".");
fflush(stdout);
#endif
if (mAccessUnitDamaged) {
accessUnit->meta()->setInt32("damaged", true);
sp<AMessage> msg = mNotifyMsg->dup();
msg->setObject("access-unit", accessUnit);
msg->post();
}
mPackets.clear();
mAccessUnitDamaged = false;
sp<AMessage> msg = mNotifyMsg->dup();
msg->setObject("access-unit", accessUnit);
msg->post();
}
ARTPAssembler::AssemblyStatus AMPEG4ElementaryAssembler::assembleMore(
@ -388,6 +396,8 @@ void AMPEG4ElementaryAssembler::packetLost() {
++mNextExpectedSeqNo;
mAccessUnitDamaged = true;
mPreviousAUCount = 0;
}
void AMPEG4ElementaryAssembler::onByeReceived() {

Просмотреть файл

@ -55,6 +55,8 @@ private:
bool mRandomAccessIndication;
unsigned mStreamStateIndication;
unsigned mAuxiliaryDataSizeLength;
unsigned mConstantDuration;
unsigned mPreviousAUCount;
bool mHasAUHeader;
uint32_t mAccessUnitRTPTime;