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 11:47:36 -04:00
Родитель c01ffbe92a
Коммит 5045ad9ced
2 изменённых файлов: 28 добавлений и 13 удалений

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

@ -1857,7 +1857,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.
@ -1874,7 +1875,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();

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

@ -713,6 +713,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)
@ -729,16 +743,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);
@ -761,6 +765,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;
@ -789,6 +796,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;
@ -811,7 +822,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.
*/