Bug 865247 - Part 1: Give MediaInputPort the notion of an input and output port number; r=roc

This commit is contained in:
Ehsan Akhgari 2013-05-05 03:04:21 -04:00
parent b279a01160
commit 8090d2c362
2 changed files with 28 additions and 13 deletions

View File

@ -1868,7 +1868,8 @@ MediaInputPort::SetGraphImpl(MediaStreamGraphImpl* aGraph)
}
already_AddRefed<MediaInputPort>
ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, uint32_t aFlags)
ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, uint32_t aFlags,
uint16_t aInputNumber, uint16_t aOutputNumber)
{
// This method creates two references to the MediaInputPort: one for
// the main thread, and one for the MediaStreamGraph.
@ -1885,7 +1886,8 @@ ProcessedMediaStream::AllocateInputPort(MediaStream* aStream, uint32_t aFlags)
}
nsRefPtr<MediaInputPort> mPort;
};
nsRefPtr<MediaInputPort> port = new MediaInputPort(aStream, this, aFlags);
nsRefPtr<MediaInputPort> port = new MediaInputPort(aStream, this, aFlags,
aInputNumber, aOutputNumber);
port->SetGraphImpl(GraphImpl());
GraphImpl()->AppendMessage(new Message(port));
return port.forget();

View File

@ -719,6 +719,20 @@ protected:
* the port and drop the graph's reference, destroying the object.
*/
class MediaInputPort {
// Do not call this constructor directly. Instead call aDest->AllocateInputPort.
MediaInputPort(MediaStream* aSource, ProcessedMediaStream* aDest,
uint32_t aFlags, uint16_t aInputNumber,
uint16_t aOutputNumber)
: mSource(aSource)
, mDest(aDest)
, mFlags(aFlags)
, mInputNumber(aInputNumber)
, mOutputNumber(aOutputNumber)
, mGraph(nullptr)
{
MOZ_COUNT_CTOR(MediaInputPort);
}
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(MediaInputPort)
@ -735,16 +749,6 @@ public:
// stream.
FLAG_BLOCK_OUTPUT = 0x02
};
// Do not call this constructor directly. Instead call aDest->AllocateInputPort.
MediaInputPort(MediaStream* aSource, ProcessedMediaStream* aDest,
uint32_t aFlags)
: mSource(aSource)
, mDest(aDest)
, mFlags(aFlags)
, mGraph(nullptr)
{
MOZ_COUNT_CTOR(MediaInputPort);
}
~MediaInputPort()
{
MOZ_COUNT_DTOR(MediaInputPort);
@ -767,6 +771,9 @@ public:
MediaStream* GetSource() { return mSource; }
ProcessedMediaStream* GetDestination() { return mDest; }
uint16_t InputNumber() const { return mInputNumber; }
uint16_t OutputNumber() const { return mOutputNumber; }
// Call on graph manager thread
struct InputInterval {
GraphTime mStart;
@ -795,6 +802,10 @@ protected:
MediaStream* mSource;
ProcessedMediaStream* mDest;
uint32_t mFlags;
// The input and output numbers are optional, and are currently only used by
// Web Audio.
const uint16_t mInputNumber;
const uint16_t mOutputNumber;
// Our media stream graph
MediaStreamGraphImpl* mGraph;
@ -817,7 +828,9 @@ public:
* This stream can be removed by calling MediaInputPort::Remove().
*/
already_AddRefed<MediaInputPort> AllocateInputPort(MediaStream* aStream,
uint32_t aFlags = 0);
uint32_t aFlags = 0,
uint16_t aInputNumber = 0,
uint16_t aOutputNumber = 0);
/**
* Force this stream into the finished state.
*/