mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
d1af43433c
- Bug 1187817. Part 1 - Move Set{Volume,PlaybackRate,PreservesPitch} to the audio thread. r=kinetik. (a234a7080)
- Bug 1187817. Part 2 - remove unused code. r=kinetik. (836c52a19)
- Bug 1187763. Part 1 - move while loop out of WaitingForAudioToPlay(). r=kinetik. (a80d70f87)
- Bug 1187763. Part 2 - extract some code of AudioLoop() into its own function. r=kinetik. (275b8bfb6)
- Bug 1187763. Part 3 - refactor AudioSink::AudioLoop into a series of events. r=kinetik (7eb3f506f)
- Bug 1187817. Part 3 - move SetPlaying to the audio thread. r=kinetik. (0fef85968)
- Bug 1187817. Part 4 - move some code in Shutdown to the audio thread. r=kinetik. (8c73fbe6d)
- Bug 1187817. Part 5 - assert some code in the audio thread and don't enter the monitor. r=kinetik. (64de4616f)
- move include (f842b4b1e)
- Bug 1163486 - Update test to use new MP4Demuxer. r=bholley (b853be477)
- Bug 1190496 - Namespace the SharedThreadPool.h include. r=cpearce (196d25d42)
- Bug 1190496 - Hoist SharedThreadPool into xpcom. r=froydnj (3dad8176f)
- Bug 1190492 - Hoist AbstractThread and TaskDispatcher to xpcom. r=froydnj (c3329fa29)
- bug 1166107 documentation of mWaitForInternalDrain thread access r=gerald (f762764b1)
- correct comment (b623b2959)
- revert demuxer check from promise reject to assert like in 1156708 (f540b270c)
- more chekcs back to asserts (7e82a0f99)
- space (733bd85a3)
- Bug 1188220: Allow disabling HW acceleration even when SharedDecoderManager isn't used. r=cpearce (909a86682)
- bug 1161903 ensure pending DrainComplete is not run after Flush() r=cpearce (648cabbb7)
- Bug 1158089 - Fall back to d3d9 DXVA if d3d11 initialization fails. r=cpearce (84b3a8e6d)
117 lines
3.8 KiB
C++
117 lines
3.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/. */
|
|
|
|
#if !defined(WMFMediaDataDecoder_h_)
|
|
#define WMFMediaDataDecoder_h_
|
|
|
|
|
|
#include "WMF.h"
|
|
#include "MFTDecoder.h"
|
|
#include "mozilla/RefPtr.h"
|
|
#include "PlatformDecoderModule.h"
|
|
|
|
namespace mozilla {
|
|
|
|
// Encapsulates the initialization of the MFTDecoder appropriate for decoding
|
|
// a given stream, and the process of converting the IMFSample produced
|
|
// by the MFT into a MediaData object.
|
|
class MFTManager {
|
|
public:
|
|
virtual ~MFTManager() {}
|
|
|
|
// Creates an initializs the MFTDecoder.
|
|
// Returns nullptr on failure.
|
|
virtual already_AddRefed<MFTDecoder> Init() = 0;
|
|
|
|
// Submit a compressed sample for decoding.
|
|
// This should forward to the MFTDecoder after performing
|
|
// any required sample formatting.
|
|
virtual HRESULT Input(MediaRawData* aSample) = 0;
|
|
|
|
// Produces decoded output, if possible. Blocks until output can be produced,
|
|
// or until no more is able to be produced.
|
|
// Returns S_OK on success, or MF_E_TRANSFORM_NEED_MORE_INPUT if there's not
|
|
// enough data to produce more output. If this returns a failure code other
|
|
// than MF_E_TRANSFORM_NEED_MORE_INPUT, an error will be reported to the
|
|
// MP4Reader.
|
|
virtual HRESULT Output(int64_t aStreamOffset,
|
|
nsRefPtr<MediaData>& aOutput) = 0;
|
|
|
|
// Destroys all resources.
|
|
virtual void Shutdown() = 0;
|
|
|
|
virtual bool IsHardwareAccelerated() const { return false; }
|
|
|
|
};
|
|
|
|
// Decodes audio and video using Windows Media Foundation. Samples are decoded
|
|
// using the MFTDecoder created by the MFTManager. This class implements
|
|
// the higher-level logic that drives mapping the MFT to the async
|
|
// MediaDataDecoder interface. The specifics of decoding the exact stream
|
|
// type are handled by MFTManager and the MFTDecoder it creates.
|
|
class WMFMediaDataDecoder : public MediaDataDecoder {
|
|
public:
|
|
WMFMediaDataDecoder(MFTManager* aOutputSource,
|
|
FlushableTaskQueue* aAudioTaskQueue,
|
|
MediaDataDecoderCallback* aCallback);
|
|
~WMFMediaDataDecoder();
|
|
|
|
virtual nsresult Init() override;
|
|
|
|
virtual nsresult Input(MediaRawData* aSample);
|
|
|
|
virtual nsresult Flush() override;
|
|
|
|
virtual nsresult Drain() override;
|
|
|
|
virtual nsresult Shutdown() override;
|
|
|
|
virtual bool IsHardwareAccelerated() const override;
|
|
|
|
private:
|
|
|
|
// Called on the task queue. Inserts the sample into the decoder, and
|
|
// extracts output if available.
|
|
void ProcessDecode(MediaRawData* aSample);
|
|
|
|
// Called on the task queue. Extracts output if available, and delivers
|
|
// it to the reader. Called after ProcessDecode() and ProcessDrain().
|
|
void ProcessOutput();
|
|
|
|
// Called on the task queue. Orders the MFT to flush. There is no output to
|
|
// extract.
|
|
void ProcessFlush();
|
|
|
|
// Called on the task queue. Orders the MFT to drain, and then extracts
|
|
// all available output.
|
|
void ProcessDrain();
|
|
|
|
void ProcessShutdown();
|
|
|
|
RefPtr<FlushableTaskQueue> mTaskQueue;
|
|
MediaDataDecoderCallback* mCallback;
|
|
|
|
RefPtr<MFTDecoder> mDecoder;
|
|
nsAutoPtr<MFTManager> mMFTManager;
|
|
|
|
// The last offset into the media resource that was passed into Input().
|
|
// This is used to approximate the decoder's position in the media resource.
|
|
int64_t mLastStreamOffset;
|
|
|
|
// For access to and waiting on mIsFlushing
|
|
Monitor mMonitor;
|
|
// Set on reader/decode thread calling Flush() to indicate that output is
|
|
// not required and so input samples on mTaskQueue need not be processed.
|
|
// Cleared on mTaskQueue.
|
|
bool mIsFlushing;
|
|
|
|
bool mIsShutDown;
|
|
};
|
|
|
|
} // namespace mozilla
|
|
|
|
#endif // WMFMediaDataDecoder_h_
|