Bug 1111413 - Part 2: Remove RequestSampleCallback. r=bholley

This commit is contained in:
Matt Woodrow 2014-12-16 23:08:42 +13:00
parent 2c7e571767
commit 646b842413
7 changed files with 0 additions and 99 deletions

View File

@ -1,47 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef MediaDataDecodedListener_h_
#define MediaDataDecodedListener_h_
#include "mozilla/Monitor.h"
#include "MediaDecoderReader.h"
namespace mozilla {
class MediaDecoderStateMachine;
class MediaData;
// A RequestSampleCallback implementation that forwards samples onto the
// MediaDecoderStateMachine via tasks that run on the supplied task queue.
template<class Target>
class MediaDataDecodedListener : public RequestSampleCallback {
public:
MediaDataDecodedListener(Target* aTarget,
MediaTaskQueue* aTaskQueue)
: mMonitor("MediaDataDecodedListener")
, mTaskQueue(aTaskQueue)
, mTarget(aTarget)
{
MOZ_ASSERT(aTarget);
MOZ_ASSERT(aTaskQueue);
}
void BreakCycles() {
MonitorAutoLock lock(mMonitor);
mTarget = nullptr;
mTaskQueue = nullptr;
}
private:
Monitor mMonitor;
RefPtr<MediaTaskQueue> mTaskQueue;
RefPtr<Target> mTarget;
};
} /* namespace mozilla */
#endif // MediaDataDecodedListener_h_

View File

@ -263,12 +263,6 @@ MediaDecoderReader::RequestAudioData()
return p;
}
void
MediaDecoderReader::SetCallback(RequestSampleCallback* aCallback)
{
mSampleDecodedCallback = aCallback;
}
MediaTaskQueue*
MediaDecoderReader::EnsureTaskQueue()
{
@ -286,10 +280,6 @@ MediaDecoderReader::EnsureTaskQueue()
void
MediaDecoderReader::BreakCycles()
{
if (mSampleDecodedCallback) {
mSampleDecodedCallback->BreakCycles();
mSampleDecodedCallback = nullptr;
}
mTaskQueue = nullptr;
}

View File

@ -19,7 +19,6 @@ namespace dom {
class TimeRanges;
}
class RequestSampleCallback;
class MediaDecoderReader;
class SharedDecoderManager;
@ -72,7 +71,6 @@ public:
// thread.
virtual nsRefPtr<ShutdownPromise> Shutdown();
virtual void SetCallback(RequestSampleCallback* aDecodedSampleCallback);
MediaTaskQueue* EnsureTaskQueue();
virtual bool OnDecodeThread()
@ -242,11 +240,6 @@ protected:
return false;
}
RequestSampleCallback* GetCallback() {
MOZ_ASSERT(mSampleDecodedCallback);
return mSampleDecodedCallback;
}
// Queue of audio frames. This queue is threadsafe, and is accessed from
// the audio, decoder, state machine, and main threads.
MediaQueue<AudioData> mAudioQueue;
@ -285,8 +278,6 @@ protected:
bool mHitAudioDecodeError;
private:
nsRefPtr<RequestSampleCallback> mSampleDecodedCallback;
// Promises used only for the base-class (sync->async adapter) implementation
// of Request{Audio,Video}Data.
MediaPromiseHolder<AudioDataPromise> mBaseAudioPromise;
@ -302,21 +293,6 @@ private:
bool mShutdown;
};
// Interface that callers to MediaDecoderReader::Request{Audio,Video}Data()
// must implement to receive the requested samples asynchronously.
// This object is refcounted, and cycles must be broken by calling
// BreakCycles() during shutdown.
class RequestSampleCallback {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(RequestSampleCallback)
// Called during shutdown to break any reference cycles.
virtual void BreakCycles() = 0;
protected:
virtual ~RequestSampleCallback() {}
};
} // namespace mozilla
#endif

View File

@ -1098,12 +1098,6 @@ nsresult MediaDecoderStateMachine::Init(MediaDecoderStateMachine* aCloneDonor)
nsresult rv = mScheduler->Init();
NS_ENSURE_SUCCESS(rv, rv);
// Note: This creates a cycle, broken in shutdown.
mMediaDecodedListener =
new MediaDataDecodedListener<MediaDecoderStateMachine>(this,
DecodeTaskQueue());
mReader->SetCallback(mMediaDecodedListener);
rv = mReader->Init(cloneReader);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -89,7 +89,6 @@ hardware (via AudioStream).
#include "MediaDecoderReader.h"
#include "MediaDecoderOwner.h"
#include "MediaMetadataManager.h"
#include "MediaDataDecodedListener.h"
class nsITimer;
@ -445,8 +444,6 @@ protected:
nsresult FinishDecodeFirstFrame();
RefPtr<MediaDataDecodedListener<MediaDecoderStateMachine>> mMediaDecodedListener;
nsAutoPtr<MetadataTags> mMetadataTags;
// True if our buffers of decoded audio are not full, and we should

View File

@ -8,7 +8,6 @@
#include "prlog.h"
#include "mozilla/dom/TimeRanges.h"
#include "DecoderTraits.h"
#include "MediaDataDecodedListener.h"
#include "MediaDecoderOwner.h"
#include "MediaSourceDecoder.h"
#include "MediaSourceUtils.h"
@ -455,13 +454,6 @@ MediaSourceReader::CreateSubDecoder(const nsACString& aType)
// borrowing.
reader->SetBorrowedTaskQueue(GetTaskQueue());
// Set a callback on the subreader that forwards calls to this reader.
// This reader will then forward them onto the state machine via this
// reader's callback.
RefPtr<MediaDataDecodedListener<MediaSourceReader>> callback =
new MediaDataDecodedListener<MediaSourceReader>(this, reader->GetTaskQueue());
reader->SetCallback(callback);
#ifdef MOZ_FMP4
reader->SetSharedDecoderManager(mSharedDecoderManager);
#endif

View File

@ -98,7 +98,6 @@ EXPORTS += [
'Latency.h',
'MediaCache.h',
'MediaData.h',
'MediaDataDecodedListener.h',
'MediaDecoder.h',
'MediaDecoderOwner.h',
'MediaDecoderReader.h',