Bug 1190676 - Part 5 - Fix consumers: PeerConnection. r=jesup

This commit is contained in:
Paul Adenot 2015-08-25 10:29:50 +02:00
parent 80f845f7ad
commit 6d5f4fe7a7
2 changed files with 39 additions and 4 deletions

View File

@ -87,6 +87,7 @@
#include "AudioStreamTrack.h"
#include "VideoStreamTrack.h"
#include "nsIScriptGlobalObject.h"
#include "MediaStreamGraph.h"
#include "DOMMediaStream.h"
#include "rlogringbuffer.h"
#include "WebrtcGlobalInformation.h"
@ -443,9 +444,12 @@ PeerConnectionImpl::~PeerConnectionImpl()
already_AddRefed<DOMMediaStream>
PeerConnectionImpl::MakeMediaStream()
{
nsRefPtr<DOMMediaStream> stream =
DOMMediaStream::CreateSourceStream(GetWindow());
MediaStreamGraph* graph =
MediaStreamGraph::GetInstance(MediaStreamGraph::AUDIO_THREAD_DRIVER,
AudioChannel::Normal);
nsRefPtr<DOMMediaStream> stream =
DOMMediaStream::CreateSourceStream(GetWindow(), graph);
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
// Make the stream data (audio/video samples) accessible to the receiving page.
// We're only certain that privacy hasn't been requested if we're connected.

View File

@ -29,11 +29,42 @@
class nsIDOMWindow;
namespace mozilla {
class MediaStreamGraph;
class MediaStreamGraphImpl;
class MediaSegment;
};
namespace mozilla {
class MediaStreamGraph;
static MediaStreamGraph* gGraph;
struct AudioChannel {
enum {
Normal
};
};
class MediaStreamGraph {
public:
// Keep this in sync with the enum in MediaStreamGraph.h
enum GraphDriverType {
AUDIO_THREAD_DRIVER,
SYSTEM_THREAD_DRIVER,
OFFLINE_THREAD_DRIVER
};
static MediaStreamGraph* GetInstance(GraphDriverType aDriverType,
uint32_t aType) {
if (gGraph) {
return gGraph;
}
gGraph = new MediaStreamGraph();
return gGraph;
}
};
}
class Fake_VideoSink {
public:
Fake_VideoSink() {}
@ -318,7 +349,7 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS
static already_AddRefed<Fake_DOMMediaStream>
CreateSourceStream(nsIDOMWindow* aWindow, uint32_t aHintContents = 0) {
CreateSourceStream(nsIDOMWindow* aWindow, mozilla::MediaStreamGraph* aGraph, uint32_t aHintContents = 0) {
Fake_SourceMediaStream *source = new Fake_SourceMediaStream();
nsRefPtr<Fake_DOMMediaStream> ds = new Fake_DOMMediaStream(source);