Backed out changeset 966aa9c1ca25 (bug 1181651) for build bustage. r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2015-08-20 09:28:55 +02:00
Родитель 20ed0b8c7c
Коммит 944b95cdee
3 изменённых файлов: 16 добавлений и 37 удалений

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

@ -68,13 +68,13 @@ private:
static inline bool
ConvertIndex(FallibleTArray<Index::Indice>& aDest,
const nsTArray<stagefright::MediaSource::Indice>& aIndex,
const stagefright::Vector<stagefright::MediaSource::Indice>& aIndex,
int64_t aMediaTime)
{
if (!aDest.SetCapacity(aIndex.Length(), mozilla::fallible)) {
if (!aDest.SetCapacity(aIndex.size(), mozilla::fallible)) {
return false;
}
for (size_t i = 0; i < aIndex.Length(); i++) {
for (size_t i = 0; i < aIndex.size(); i++) {
Index::Indice indice;
const stagefright::MediaSource::Indice& s_indice = aIndex[i];
indice.start_offset = s_indice.start_offset;

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

@ -23,7 +23,6 @@
#include <media/stagefright/MediaErrors.h>
#include <utils/RefBase.h>
#include <utils/Vector.h>
#include "nsTArray.h"
namespace stagefright {
@ -119,7 +118,7 @@ struct MediaSource : public virtual RefBase {
bool sync;
};
virtual nsTArray<Indice> exportIndex() = 0;
virtual Vector<Indice> exportIndex() = 0;
protected:
virtual ~MediaSource();

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

@ -62,7 +62,7 @@ public:
virtual status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL);
virtual status_t fragmentedRead(MediaBuffer **buffer, const ReadOptions *options = NULL);
virtual nsTArray<Indice> exportIndex();
virtual Vector<Indice> exportIndex();
protected:
virtual ~MPEG4Source();
@ -4108,30 +4108,13 @@ static int compositionOrder(MediaSource::Indice* const* indice0,
}
}
class CompositionSorter
Vector<MediaSource::Indice> MPEG4Source::exportIndex()
{
public:
bool LessThan(MediaSource::Indice* aFirst, MediaSource::Indice* aSecond) const
{
return aFirst->start_composition < aSecond->start_composition;
}
bool Equals(MediaSource::Indice* aFirst, MediaSource::Indice* aSecond) const
{
return aFirst->start_composition == aSecond->start_composition;
}
};
nsTArray<MediaSource::Indice> MPEG4Source::exportIndex()
{
FallibleTArray<MediaSource::Indice> index;
Vector<Indice> index;
if (!mTimescale) {
return index;
}
if (!index.SetCapacity(mSampleTable->countSamples(), mozilla::fallible)) {
return index;
}
for (uint32_t sampleIndex = 0; sampleIndex < mSampleTable->countSamples();
sampleIndex++) {
off64_t offset;
@ -4155,23 +4138,20 @@ nsTArray<MediaSource::Indice> MPEG4Source::exportIndex()
indice.end_composition =
(compositionTime * 1000000ll + duration * 1000000ll) / mTimescale;
indice.sync = isSyncSample;
// FIXME: Make this infallible after bug 968520 is done.
MOZ_ALWAYS_TRUE(index.AppendElement(indice, mozilla::fallible));
index.add(indice);
}
// Fix up composition durations so we don't end up with any unsightly gaps.
if (index.Length() != 0) {
FallibleTArray<Indice*> composition_order;
if (!composition_order.SetCapacity(index.Length(), mozilla::fallible)) {
return index;
}
for (uint32_t i = 0; i < index.Length(); i++) {
// FIXME: Make this infallible after bug 968520 is done.
MOZ_ALWAYS_TRUE(composition_order.AppendElement(&index[i], mozilla::fallible));
if (index.size() != 0) {
Indice* array = index.editArray();
Vector<Indice*> composition_order;
composition_order.reserve(index.size());
for (uint32_t i = 0; i < index.size(); i++) {
composition_order.add(&array[i]);
}
composition_order.Sort(CompositionSorter());
for (uint32_t i = 0; i + 1 < composition_order.Length(); i++) {
composition_order.sort(compositionOrder);
for (uint32_t i = 0; i + 1 < composition_order.size(); i++) {
composition_order[i]->end_composition =
composition_order[i + 1]->start_composition;
}