mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
967126c55b
- Bug 1162211 Use sqlite private cache mode in Cache API. r=ehsan (7d91c65569) - Bug 1220308 Cache API should teardown DOM objects when Worker hits Terminating status. r=baku (a50fd37df1) - Bug 1144214 - Fix DeleteOrphanedBodyAction so that it doesn't orphan cache files if the action is canceled; r=bkelly (df310a4915) - Bug 1243849 - Restore support for accessing the Cache API from app://URLs and also for storing requests/responses with app:// URLs within it; r=bkelly (07144da733) - Bug 1199434 - Fire an event when the print engine encounters an error. r=smaug (e714d1f979) - Bug 1230092. Make nsIDOMCustomEvent no longer inherit from nsIDOMEvent, so that CustomEvent doesn't end up with multiple inheritance from nsIDOMEvent. r=smaug (cd8e1b5ff5) - Bug 1177927: Use nsFrameList::GetLength() instead of manual iteration to count pages in nsPrintEngine. r=tn (ddcdde1201) - Bug 1177927: Use nsFrameList::GetLength() instead of manual iteration to count pages in nsPrintEngine. r=tn (6b8944ab43) - Bug 1196896 - add CSSLexer.performEOFFixup. r=heycam, r=bz (c5159fc644) - Bug 1153378 - Move local variable in behind #ifndef MOZILLA_XPCOMRT_API. r=jesup (8e5a9c1c48) - Bug 1227396: P1. Remove TimestampedMediaByteRange object. r=cpearce (1fae1c62c5) - Bug 1201404 - Implement minimal gtests to exercise the MPEG4 parser - r=rillian (2a47ebc9e4) - Bug 1187067 - Added gtests using the bug's test file, running simple checks and many parsing runs to catch parser crashes. r=rillian (71027a9572) - Bug 1138992: P2. Add gtest. r=kentuckyfriedtakahe (672e0975a1) - Bug 1200326 - P 1 - Moved test case contents from test source into separate file - r=rillian (e3cdcdd121) - Bug 1200326 - part 2 - Parse subsets of the input stream - r=rillian (c72577319e) - Bug 1200326 - p3 - Test case filenames are now in a list, to allow adding more tests - r=rillian (e8a21b4842) - Bug 1200326 - p4 - Added test case from bug 1200326, with more checks - r=rillian (8befb8260f) - Bug 1204580 - p1: Added test case files. r=rillian (6573cf686d) - Bug 1181213 - Added Added mp4 test case to libstagefright gtest - r=rillian (1278f9dc75) - Bug 1181719 - p1: Added mp4 test case to libstagefright gtest - r=rillian (7ea78da4d9) - Bug 1181223 - p1: Added mp4 test case to libstagefright gtest - r=rillian (14f0b6c719) - Bug 1156505 - p1: Added test case file from bug. r=rillian (9d188b3c6a) - Bug 1181220 - p1: Added mp4 test case to libstagefright gtest - r=rillian (b98029cb8e) - Bug 1181215 - p1: Added mp4 test case to libstagefright gtest - r=rillian (2c20d374b7) - Bug 1185230 - p1: Added mp4 test case to libstagefright gtest - r=rillian (e848ebec16) - Bug 1216748 - p1. Added test case with different 'covr' sizes - r=rillian (1c0097dc85) - Bug 1224019 - Disable Stagefright subset gtests - r=jya, rs=botond (5ee3e6319c) - Bug 1227396: P2. Rename some MediaByteRange methods. r=cpearce (3d14aeb56b) - Bug 1227396: P3. Add IntervalSet::LastInterval method. r=gerald (96b8503a26) - Bug 1227396: P4. Add IntervalSet::Clear method. r=gerald (460ff0cd8f) - Bug 1227396: P5. Make Interval::Span ignore empty interval. r=gerald (ba16de0a91) - Bug 1227396: P6. Replace MediaByteBuffer with Interval<int64_t>. r=cpearce (eed5d5ca5c) - Bug 1227396: P7. Replace nsTArray<MediaByteRange> with dedicated MediaByteRangeSet object. r=cpearce (ea59b05aea) - Bug 1188150 - ADTSContainerParser gtest. r=jya (6a4a061647) - Bug 1227396: P8. Replace MediaByteRange with Interval<int64_t> typedef. r=cpearce (4d3e657b3b) - Bug 1219047 - Call rust mp4parser with logging. r=kinetik (70abf59813) - Bug 1220882 - Use LazyLogModule in MP4Metadata. r=kinetik (3443b56be3) - Bug 1220885 - Add telemetry probe for rust mp4parse success. r=kinetik p=ally (c012bd11bf) - Bug 1174356 - Add missing MediaData include. r=jya (bfe6182cfe) - Bug 1227396: P9. Remove unnecessary monitor. r=cpearce (4f156658c4) - Bug 1227396: P10: Remove stray function definition. r=cpearce (4c1641560c) - Bug 1227396: P11. Add IntervalSet::operator- operand. r=gerald (b56ceb52f4) - Bug 1227396: P12. Use MediaByteRangeSet capabilities to filter already processed data. r=cpearce (098d8852d9) - Bug 1227396: P13. Refactor how MP4 buffered range is calculated. r=cpearce (66711bd76f) - Bug 1227396: P14. Reduce memory usage of sample index for audio tracks. r=cpearce (e1c36bd791) - Bug 1197007: Turn off optimization for GMPLoaderImpl::Load. r=cpearce (5df0a365c7) - Bug 1208892 - Replace the uses of memset to clean up data in GMPLoader::Load with an inline memset; r=cpearce (ce4f3a3a64) - Bug 1187031: Move back to using USER_LOCKDOWN for the GMP sandbox policy on Windows. r=aklotz (53c39be48d) - Bug 1214018 - p1: Using vector to pass machine id - r=cpearce (19782ec5b3) - Bug 1214018 - p2: Import machine_id_mac.cc from Chromium repo - r=cpearce (000d4734ab) - Bug 1214018 - p3: Modify machine_id_mac for FF build - r=cpearce (41818ddc72) - Bug 1214018 - p4: Use machine_id_mac in GMPLoader - r=cpearce (4af56e5a6e) - Bug 1220326 - Wipe stack after Mac node id generation. r=jrmuizel (8c94ddab25) - Bug 1181718 - Fallible allocation of blank audio data - r=jya (7867407417) - Bug 1229963 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in dom/media/; r=cpearce (796241f002) - Bug 1229965 - Use MakeUniqueFallible in blank decoder - r=jya (bac70f5c80) - Bug 1139256 - remove the assertion in AudioStream::GetPositionInFramesUnlocked(). See bug 1139256 comment 4 for the detail. r=kinetik. (6e386c7b00) - missing bits (1dc7b00da3) - Bug 1185115: P2. replace all stagefright::Vector with nsTArray. r=kentuckyfriedtakahe (de4e57b4cd) - Bug 1181223 - p2: Handle wrong saio/saiz size instead of assuming it is correct - r=rillian (59f5afa21f) - Bug 1138992: P1. Ignore ctts version if we have 0 samples in the table. r=kentuckyfriedtakahe (efb86ce02d) - Bug 1216845 - Check fallible allocations - r=rillian (fac4210e2a) - Bug 1229615 - Compare track counts between rust and stagefright. r=rillian (1b7ee2e4a8) - Bug 1219475 - Fix a comparison warning. r=gerald (2efe7f952d) - Bug 1181719 - p2: Check numBitsLeft before each getBits - r=rillian (f7bd7039ed) - Bug 1187067 - Null-check mLastTrack before dereferencing it - r=rillian (e2d99073ff) - Bug 1181220 - p2: Check if MIME types are valid - r=rillian (c1d1254f6d) - Bug 1185230 - p2: Store MPEG4Source::mTimescale as uint32_t - r=rillian (21d124ab25) - Bug 1207909 - p1: Fixed ALOGV statement - r=jya (0aef385b41) - Bug 1207909 - p2: Fixed a warning (uninitialized 'err') and typo - r=jya (a9c157feda) - partial remove of hack (59ca36fbd4) - Bug 1156505 - p2: Null-check sampleTable before use. r=rillian (ab18d1d939) - Bug 1181215 - p2: Better track verification - r=rillian (d61d5914aa) - Bug 1210319 - p1. Removed unused code - r=rillian (4c0b33fc59) - Bug 1210319 - p2. Minor intf clean-up, RIP trex - r=rillian (27aaf6ae80) - Bug 1229134: Check that memory allocation actually succeeded. r=gerald (b6587bc900) - Bug 1209388: [mp3] Remove AppleMP3Reader. r=kentuckyfriedtakahe (e81f265901) - Bug 1198576 - Remove MediaCodecReader. r=bwu (e867950ff4) - Bug 1191833: P1. Properly check webm mimetype against codec type. r=cpearce (9b27b8064a) - Bug 1229605: [MSE] Allow webm/audio independently of video. r=kentuckyfriedtakahe (7b79dfaf4c) - Bug 1229339: Partial revert of commit c15c9f37f. r=cpearce (90fa115b64)
279 lines
8.8 KiB
C++
279 lines
8.8 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "ImageContainer.h"
|
|
#include "MediaDecoderReader.h"
|
|
#include "MediaInfo.h"
|
|
#include "mozilla/CheckedInt.h"
|
|
#include "mozilla/mozalloc.h" // for operator new, and new (fallible)
|
|
#include "mozilla/RefPtr.h"
|
|
#include "mozilla/TaskQueue.h"
|
|
#include "mozilla/UniquePtr.h"
|
|
#include "mozilla/UniquePtrExtensions.h"
|
|
#include "nsRect.h"
|
|
#include "PlatformDecoderModule.h"
|
|
#include "TimeUnits.h"
|
|
#include "VideoUtils.h"
|
|
|
|
namespace mozilla {
|
|
|
|
// Decoder that uses a passed in object's Create function to create blank
|
|
// MediaData objects.
|
|
template<class BlankMediaDataCreator>
|
|
class BlankMediaDataDecoder : public MediaDataDecoder {
|
|
public:
|
|
|
|
BlankMediaDataDecoder(BlankMediaDataCreator* aCreator,
|
|
FlushableTaskQueue* aTaskQueue,
|
|
MediaDataDecoderCallback* aCallback,
|
|
TrackInfo::TrackType aType)
|
|
: mCreator(aCreator)
|
|
, mTaskQueue(aTaskQueue)
|
|
, mCallback(aCallback)
|
|
, mType(aType)
|
|
{
|
|
}
|
|
|
|
RefPtr<InitPromise> Init() override {
|
|
return InitPromise::CreateAndResolve(mType, __func__);
|
|
}
|
|
|
|
nsresult Shutdown() override {
|
|
return NS_OK;
|
|
}
|
|
|
|
class OutputEvent : public nsRunnable {
|
|
public:
|
|
OutputEvent(MediaRawData* aSample,
|
|
MediaDataDecoderCallback* aCallback,
|
|
BlankMediaDataCreator* aCreator)
|
|
: mSample(aSample)
|
|
, mCreator(aCreator)
|
|
, mCallback(aCallback)
|
|
{
|
|
}
|
|
NS_IMETHOD Run() override
|
|
{
|
|
RefPtr<MediaData> data =
|
|
mCreator->Create(media::TimeUnit::FromMicroseconds(mSample->mTime),
|
|
media::TimeUnit::FromMicroseconds(mSample->mDuration),
|
|
mSample->mOffset);
|
|
if (!data) {
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
}
|
|
mCallback->Output(data);
|
|
return NS_OK;
|
|
}
|
|
private:
|
|
RefPtr<MediaRawData> mSample;
|
|
BlankMediaDataCreator* mCreator;
|
|
MediaDataDecoderCallback* mCallback;
|
|
};
|
|
|
|
nsresult Input(MediaRawData* aSample) override
|
|
{
|
|
// The MediaDataDecoder must delete the sample when we're finished
|
|
// with it, so the OutputEvent stores it in an nsAutoPtr and deletes
|
|
// it once it's run.
|
|
RefPtr<nsIRunnable> r(new OutputEvent(aSample, mCallback, mCreator));
|
|
mTaskQueue->Dispatch(r.forget());
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult Flush() override {
|
|
mTaskQueue->Flush();
|
|
return NS_OK;
|
|
}
|
|
|
|
nsresult Drain() override {
|
|
mCallback->DrainComplete();
|
|
return NS_OK;
|
|
}
|
|
|
|
private:
|
|
nsAutoPtr<BlankMediaDataCreator> mCreator;
|
|
RefPtr<FlushableTaskQueue> mTaskQueue;
|
|
MediaDataDecoderCallback* mCallback;
|
|
TrackInfo::TrackType mType;
|
|
};
|
|
|
|
class BlankVideoDataCreator {
|
|
public:
|
|
BlankVideoDataCreator(uint32_t aFrameWidth,
|
|
uint32_t aFrameHeight,
|
|
layers::ImageContainer* aImageContainer)
|
|
: mFrameWidth(aFrameWidth)
|
|
, mFrameHeight(aFrameHeight)
|
|
, mImageContainer(aImageContainer)
|
|
{
|
|
mInfo.mDisplay = nsIntSize(mFrameWidth, mFrameHeight);
|
|
mPicture = gfx::IntRect(0, 0, mFrameWidth, mFrameHeight);
|
|
}
|
|
|
|
already_AddRefed<MediaData>
|
|
Create(const media::TimeUnit& aDTS, const media::TimeUnit& aDuration, int64_t aOffsetInStream)
|
|
{
|
|
// Create a fake YUV buffer in a 420 format. That is, an 8bpp Y plane,
|
|
// with a U and V plane that are half the size of the Y plane, i.e 8 bit,
|
|
// 2x2 subsampled. Have the data pointers of each frame point to the
|
|
// first plane, they'll always be zero'd memory anyway.
|
|
auto frame = MakeUnique<uint8_t[]>(mFrameWidth * mFrameHeight);
|
|
memset(frame.get(), 0, mFrameWidth * mFrameHeight);
|
|
VideoData::YCbCrBuffer buffer;
|
|
|
|
// Y plane.
|
|
buffer.mPlanes[0].mData = frame.get();
|
|
buffer.mPlanes[0].mStride = mFrameWidth;
|
|
buffer.mPlanes[0].mHeight = mFrameHeight;
|
|
buffer.mPlanes[0].mWidth = mFrameWidth;
|
|
buffer.mPlanes[0].mOffset = 0;
|
|
buffer.mPlanes[0].mSkip = 0;
|
|
|
|
// Cb plane.
|
|
buffer.mPlanes[1].mData = frame.get();
|
|
buffer.mPlanes[1].mStride = mFrameWidth / 2;
|
|
buffer.mPlanes[1].mHeight = mFrameHeight / 2;
|
|
buffer.mPlanes[1].mWidth = mFrameWidth / 2;
|
|
buffer.mPlanes[1].mOffset = 0;
|
|
buffer.mPlanes[1].mSkip = 0;
|
|
|
|
// Cr plane.
|
|
buffer.mPlanes[2].mData = frame.get();
|
|
buffer.mPlanes[2].mStride = mFrameWidth / 2;
|
|
buffer.mPlanes[2].mHeight = mFrameHeight / 2;
|
|
buffer.mPlanes[2].mWidth = mFrameWidth / 2;
|
|
buffer.mPlanes[2].mOffset = 0;
|
|
buffer.mPlanes[2].mSkip = 0;
|
|
|
|
return VideoData::Create(mInfo,
|
|
mImageContainer,
|
|
nullptr,
|
|
aOffsetInStream,
|
|
aDTS.ToMicroseconds(),
|
|
aDuration.ToMicroseconds(),
|
|
buffer,
|
|
true,
|
|
aDTS.ToMicroseconds(),
|
|
mPicture);
|
|
}
|
|
private:
|
|
VideoInfo mInfo;
|
|
gfx::IntRect mPicture;
|
|
uint32_t mFrameWidth;
|
|
uint32_t mFrameHeight;
|
|
RefPtr<layers::ImageContainer> mImageContainer;
|
|
};
|
|
|
|
|
|
class BlankAudioDataCreator {
|
|
public:
|
|
BlankAudioDataCreator(uint32_t aChannelCount, uint32_t aSampleRate)
|
|
: mFrameSum(0), mChannelCount(aChannelCount), mSampleRate(aSampleRate)
|
|
{
|
|
}
|
|
|
|
MediaData* Create(const media::TimeUnit& aDTS,
|
|
const media::TimeUnit& aDuration,
|
|
int64_t aOffsetInStream)
|
|
{
|
|
// Convert duration to frames. We add 1 to duration to account for
|
|
// rounding errors, so we get a consistent tone.
|
|
CheckedInt64 frames =
|
|
UsecsToFrames(aDuration.ToMicroseconds()+1, mSampleRate);
|
|
if (!frames.isValid() ||
|
|
!mChannelCount ||
|
|
!mSampleRate ||
|
|
frames.value() > (UINT32_MAX / mChannelCount)) {
|
|
return nullptr;
|
|
}
|
|
auto samples =
|
|
MakeUniqueFallible<AudioDataValue[]>(frames.value() * mChannelCount);
|
|
if (!samples) {
|
|
return nullptr;
|
|
}
|
|
// Fill the sound buffer with an A4 tone.
|
|
static const float pi = 3.14159265f;
|
|
static const float noteHz = 440.0f;
|
|
for (int i = 0; i < frames.value(); i++) {
|
|
float f = sin(2 * pi * noteHz * mFrameSum / mSampleRate);
|
|
for (unsigned c = 0; c < mChannelCount; c++) {
|
|
samples[i * mChannelCount + c] = AudioDataValue(f);
|
|
}
|
|
mFrameSum++;
|
|
}
|
|
return new AudioData(aOffsetInStream,
|
|
aDTS.ToMicroseconds(),
|
|
aDuration.ToMicroseconds(),
|
|
uint32_t(frames.value()),
|
|
Move(samples),
|
|
mChannelCount,
|
|
mSampleRate);
|
|
}
|
|
|
|
private:
|
|
int64_t mFrameSum;
|
|
uint32_t mChannelCount;
|
|
uint32_t mSampleRate;
|
|
};
|
|
|
|
class BlankDecoderModule : public PlatformDecoderModule {
|
|
public:
|
|
|
|
// Decode thread.
|
|
already_AddRefed<MediaDataDecoder>
|
|
CreateVideoDecoder(const VideoInfo& aConfig,
|
|
layers::LayersBackend aLayersBackend,
|
|
layers::ImageContainer* aImageContainer,
|
|
FlushableTaskQueue* aVideoTaskQueue,
|
|
MediaDataDecoderCallback* aCallback) override {
|
|
BlankVideoDataCreator* creator = new BlankVideoDataCreator(
|
|
aConfig.mDisplay.width, aConfig.mDisplay.height, aImageContainer);
|
|
RefPtr<MediaDataDecoder> decoder =
|
|
new BlankMediaDataDecoder<BlankVideoDataCreator>(creator,
|
|
aVideoTaskQueue,
|
|
aCallback,
|
|
TrackInfo::kVideoTrack);
|
|
return decoder.forget();
|
|
}
|
|
|
|
// Decode thread.
|
|
already_AddRefed<MediaDataDecoder>
|
|
CreateAudioDecoder(const AudioInfo& aConfig,
|
|
FlushableTaskQueue* aAudioTaskQueue,
|
|
MediaDataDecoderCallback* aCallback) override {
|
|
BlankAudioDataCreator* creator = new BlankAudioDataCreator(
|
|
aConfig.mChannels, aConfig.mRate);
|
|
|
|
RefPtr<MediaDataDecoder> decoder =
|
|
new BlankMediaDataDecoder<BlankAudioDataCreator>(creator,
|
|
aAudioTaskQueue,
|
|
aCallback,
|
|
TrackInfo::kAudioTrack);
|
|
return decoder.forget();
|
|
}
|
|
|
|
bool
|
|
SupportsMimeType(const nsACString& aMimeType) const override
|
|
{
|
|
return true;
|
|
}
|
|
|
|
ConversionRequired
|
|
DecoderNeedsConversion(const TrackInfo& aConfig) const override
|
|
{
|
|
return kNeedNone;
|
|
}
|
|
|
|
};
|
|
|
|
already_AddRefed<PlatformDecoderModule> CreateBlankDecoderModule()
|
|
{
|
|
RefPtr<PlatformDecoderModule> pdm = new BlankDecoderModule();
|
|
return pdm.forget();
|
|
}
|
|
|
|
} // namespace mozilla
|