Backed out 2 changesets (bug 1240201) for Windows wpt bustage a=merge

Backed out changeset b06a049cafb7 (bug 1240201)
Backed out changeset 69b695ad6d43 (bug 1240201)

--HG--
extra : commitid : JaEda53eiL6
extra : source : 8381cc4aa935537a9abb72bc645a538e21862c94
This commit is contained in:
Wes Kocher 2016-01-21 12:28:24 -08:00
Родитель 45a0a54e73
Коммит fe7ebe9593
4 изменённых файлов: 4 добавлений и 127 удалений

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

@ -17,63 +17,9 @@ extern mozilla::LogModule* GetPDMLog();
namespace mozilla {
VorbisPacketSampleCounter::VorbisPacketSampleCounter()
: mError(0)
, mVorbisPacketCount(0)
{
vorbis_info_init(&mVorbisInfo);
vorbis_comment_init(&mVorbisComment);
}
bool
VorbisPacketSampleCounter::Init(const nsTArray<const uint8_t*>& aHeaders,
const nsTArray<size_t>& aHeaderLens)
{
for (size_t i = 0; i < aHeaders.Length(); i++) {
ogg_packet pkt =
VorbisDataDecoder::InitVorbisPacket(aHeaders[i], aHeaderLens[i],
i == 0, false, 0, mVorbisPacketCount++);
if ((mError = vorbis_synthesis_headerin(&mVorbisInfo, &mVorbisComment, &pkt))) {
return false;
}
}
return true;
}
int
VorbisPacketSampleCounter::GetNumSamples(const uint8_t* aData, size_t aLength)
{
if (mError) {
return -1;
}
ogg_packet pkt =
VorbisDataDecoder::InitVorbisPacket(aData, aLength, false, false, -1, mVorbisPacketCount++);
long blockSize = vorbis_packet_blocksize(&mVorbisInfo, &pkt);
if (blockSize < 0) {
return blockSize;
}
int nsamples;
if (mVorbisLastBlockSize) {
nsamples = mVorbisLastBlockSize.ref() / 4 + blockSize / 4;
} else {
// The first packet will output no audio, so set its count as 0.
nsamples = 0;
}
mVorbisLastBlockSize = Some(blockSize);
return nsamples;
}
VorbisPacketSampleCounter::~VorbisPacketSampleCounter()
{
vorbis_info_clear(&mVorbisInfo);
vorbis_comment_clear(&mVorbisComment);
}
/* static */
ogg_packet
VorbisDataDecoder::InitVorbisPacket(const unsigned char* aData, size_t aLength,
bool aBOS, bool aEOS,
int64_t aGranulepos, int64_t aPacketNo)
ogg_packet InitVorbisPacket(const unsigned char* aData, size_t aLength,
bool aBOS, bool aEOS,
int64_t aGranulepos, int64_t aPacketNo)
{
ogg_packet packet;
packet.packet = const_cast<unsigned char*>(aData);

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

@ -17,25 +17,6 @@
namespace mozilla {
class VorbisPacketSampleCounter
{
public:
VorbisPacketSampleCounter();
~VorbisPacketSampleCounter();
bool Init(const nsTArray<const uint8_t*>& aHeaders,
const nsTArray<size_t>& aHeaderLens);
int GetNumSamples(const uint8_t* aData, size_t aLength);
void Reset() { mVorbisLastBlockSize.reset(); }
private:
int mError;
vorbis_info mVorbisInfo;
vorbis_comment mVorbisComment;
int64_t mVorbisPacketCount;
Maybe<long> mVorbisLastBlockSize;
};
class VorbisDataDecoder : public MediaDataDecoder
{
public:
@ -53,10 +34,6 @@ public:
// Return true if mimetype is Vorbis
static bool IsVorbis(const nsACString& aMimeType);
static ogg_packet InitVorbisPacket(const unsigned char* aData, size_t aLength,
bool aBOS, bool aEOS,
int64_t aGranulepos, int64_t aPacketNo);
private:
nsresult DecodeHeader(const unsigned char* aData, size_t aLength);

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

@ -12,13 +12,11 @@
#include "WebMBufferedParser.h"
#include "gfx2DGlue.h"
#include "mozilla/Endian.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Preferences.h"
#include "mozilla/SharedThreadPool.h"
#include "MediaDataDemuxer.h"
#include "nsAutoRef.h"
#include "NesteggPacketHolder.h"
#include "VideoUtils.h"
#include "XiphExtradata.h"
#include "prprf.h"
@ -29,8 +27,6 @@
#include "vpx/vp8dx.h"
#include "vpx/vpx_decoder.h"
#include <opus/opus.h>
#define WEBM_DEBUG(arg, ...) MOZ_LOG(gWebMDemuxerLog, mozilla::LogLevel::Debug, ("WebMDemuxer(%p)::%s: " arg, this, __func__, ##__VA_ARGS__))
namespace mozilla {
@ -421,13 +417,6 @@ WebMDemuxer::ReadMetadata()
mInfo.mAudio.mCodecSpecificConfig->AppendElements(headers[0],
headerLens[0]);
}
if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
if (!mVorbisCounter.Init(headers, headerLens)) {
return NS_ERROR_FAILURE;
}
}
uint64_t duration = 0;
r = nestegg_duration(mContext, &duration);
if (!r) {
@ -553,7 +542,6 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
(void) nestegg_packet_discard_padding(holder->Packet(), &discardPadding);
for (uint32_t i = 0; i < count; ++i) {
int64_t duration = next_tstamp - tstamp;
unsigned char* data;
size_t length;
r = nestegg_packet_data(holder->Packet(), i, &data, &length);
@ -564,31 +552,6 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
bool isKeyframe = false;
if (aType == TrackInfo::kAudioTrack) {
isKeyframe = true;
switch (mAudioCodec) {
case NESTEGG_CODEC_VORBIS:
{
int nsamples = mVorbisCounter.GetNumSamples(data, length);
if (nsamples < 0) {
return false;
}
duration =
FramesToTimeUnit(nsamples, mInfo.mAudio.mRate).ToMicroseconds();
break;
}
case NESTEGG_CODEC_OPUS:
{
int nsamples =
opus_packet_get_nb_samples(data, length, mInfo.mAudio.mRate);
if (nsamples < 0) {
return false;
}
duration =
FramesToTimeUnit(nsamples, mInfo.mAudio.mRate).ToMicroseconds();
break;
}
default:
break;
}
} else if (aType == TrackInfo::kVideoTrack) {
vpx_codec_stream_info_t si;
PodZero(&si);
@ -609,7 +572,7 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
RefPtr<MediaRawData> sample = new MediaRawData(data, length);
sample->mTimecode = tstamp;
sample->mTime = tstamp;
sample->mDuration = duration;
sample->mDuration = next_tstamp - tstamp;
sample->mOffset = holder->Offset();
sample->mKeyframe = isKeyframe;
if (discardPadding) {
@ -619,10 +582,6 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
sample->mExtraData->AppendElements(&c[0], 8);
}
aSamples->Push(sample);
if (mAudioCodec == NESTEGG_CODEC_VORBIS ||
mAudioCodec == NESTEGG_CODEC_OPUS) {
tstamp += duration;
}
}
return true;
}
@ -762,7 +721,6 @@ WebMDemuxer::SeekInternal(const media::TimeUnit& aTarget)
mLastAudioFrameTime.reset();
mLastVideoFrameTime.reset();
mVorbisCounter.Reset();
return NS_OK;
}

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

@ -9,10 +9,8 @@
#include "nsTArray.h"
#include "MediaDataDemuxer.h"
#include "NesteggPacketHolder.h"
#include "mozilla/Maybe.h"
#include "mozilla/Move.h"
#include "VorbisDecoder.h"
typedef struct nestegg nestegg;
namespace mozilla {
@ -201,8 +199,6 @@ private:
// as nestegg only performs 1-byte read at a time.
int64_t mLastWebMBlockOffset;
const bool mIsMediaSource;
VorbisPacketSampleCounter mVorbisCounter;
};
class WebMTrackDemuxer : public MediaTrackDemuxer