mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 822956: backout 3dead2094684 due to breaking normal PeerConnection cases rs=me
This commit is contained in:
parent
bc2712da19
commit
da905bb932
@ -95,20 +95,18 @@ nsDOMLocalMediaStream::CreateSourceStream(uint32_t aHintContents)
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMMediaStream>
|
||||
nsDOMMediaStream::CreateTrackUnionStream(uint32_t aHintContents)
|
||||
nsDOMMediaStream::CreateTrackUnionStream()
|
||||
{
|
||||
nsRefPtr<nsDOMMediaStream> stream = new nsDOMMediaStream();
|
||||
stream->SetHintContents(aHintContents);
|
||||
MediaStreamGraph* gm = MediaStreamGraph::GetInstance();
|
||||
stream->mStream = gm->CreateTrackUnionStream(stream);
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsDOMLocalMediaStream>
|
||||
nsDOMLocalMediaStream::CreateTrackUnionStream(uint32_t aHintContents)
|
||||
nsDOMLocalMediaStream::CreateTrackUnionStream()
|
||||
{
|
||||
nsRefPtr<nsDOMLocalMediaStream> stream = new nsDOMLocalMediaStream();
|
||||
stream->SetHintContents(aHintContents);
|
||||
MediaStreamGraph* gm = MediaStreamGraph::GetInstance();
|
||||
stream->mStream = gm->CreateTrackUnionStream(stream);
|
||||
return stream.forget();
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
/**
|
||||
* Create an nsDOMMediaStream whose underlying stream is a TrackUnionStream.
|
||||
*/
|
||||
static already_AddRefed<nsDOMMediaStream> CreateTrackUnionStream(uint32_t aHintContents = 0);
|
||||
static already_AddRefed<nsDOMMediaStream> CreateTrackUnionStream();
|
||||
|
||||
protected:
|
||||
// MediaStream is owned by the graph, but we tell it when to die, and it won't
|
||||
@ -106,7 +106,7 @@ public:
|
||||
/**
|
||||
* Create an nsDOMLocalMediaStream whose underlying stream is a TrackUnionStream.
|
||||
*/
|
||||
static already_AddRefed<nsDOMLocalMediaStream> CreateTrackUnionStream(uint32_t aHintContents = 0);
|
||||
static already_AddRefed<nsDOMLocalMediaStream> CreateTrackUnionStream();
|
||||
};
|
||||
|
||||
#endif /* NSDOMMEDIASTREAM_H_ */
|
||||
|
@ -262,29 +262,21 @@ public:
|
||||
|
||||
// Create a media stream.
|
||||
nsRefPtr<nsDOMLocalMediaStream> stream;
|
||||
nsRefPtr<nsDOMLocalMediaStream> trackunion;
|
||||
uint32_t hints = (mAudioSource ? nsDOMMediaStream::HINT_CONTENTS_AUDIO : 0);
|
||||
hints |= (mVideoSource ? nsDOMMediaStream::HINT_CONTENTS_VIDEO : 0);
|
||||
|
||||
stream = nsDOMLocalMediaStream::CreateSourceStream(hints);
|
||||
trackunion = nsDOMLocalMediaStream::CreateTrackUnionStream(hints);
|
||||
if (!stream || !trackunion) {
|
||||
stream = nsDOMLocalMediaStream::CreateSourceStream(hints);
|
||||
if (!stream) {
|
||||
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
|
||||
LOG(("Returning error for getUserMedia() - no stream"));
|
||||
error->OnError(NS_LITERAL_STRING("NO_STREAM"));
|
||||
return NS_OK;
|
||||
}
|
||||
// connect the source stream to the track union stream to avoid us blocking
|
||||
trackunion->GetStream()->AsProcessedStream()->SetAutofinish(true);
|
||||
nsRefPtr<MediaInputPort> port = trackunion->GetStream()->AsProcessedStream()->
|
||||
AllocateInputPort(stream->GetStream()->AsSourceStream(),
|
||||
MediaInputPort::FLAG_BLOCK_OUTPUT);
|
||||
|
||||
nsPIDOMWindow *window = static_cast<nsPIDOMWindow*>
|
||||
(nsGlobalWindow::GetInnerWindowWithId(mWindowID));
|
||||
if (window && window->GetExtantDoc()) {
|
||||
stream->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
|
||||
trackunion->CombineWithPrincipal(window->GetExtantDoc()->NodePrincipal());
|
||||
}
|
||||
|
||||
// Ensure there's a thread for gum to proxy to off main thread
|
||||
@ -295,7 +287,6 @@ public:
|
||||
// when the page is invalidated (on navigation or close).
|
||||
GetUserMediaCallbackMediaStreamListener* listener =
|
||||
new GetUserMediaCallbackMediaStreamListener(mediaThread, stream,
|
||||
port.forget(),
|
||||
mAudioSource,
|
||||
mVideoSource);
|
||||
stream->GetStream()->AddListener(listener);
|
||||
@ -320,7 +311,7 @@ public:
|
||||
// This is safe since we're on main-thread, and the windowlist can only
|
||||
// be invalidated from the main-thread (see OnNavigation)
|
||||
LOG(("Returning success for getUserMedia()"));
|
||||
success->OnSuccess(static_cast<nsIDOMLocalMediaStream*>(trackunion));
|
||||
success->OnSuccess(static_cast<nsIDOMLocalMediaStream*>(stream));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -89,7 +89,6 @@ public:
|
||||
, mStream(aStream)
|
||||
{}
|
||||
|
||||
// so we can send Stop without AddRef()ing from the MSG thread
|
||||
MediaOperationRunnable(MediaOperation aType,
|
||||
SourceMediaStream* aStream,
|
||||
MediaEngineSource* aAudioSource,
|
||||
@ -162,7 +161,6 @@ public:
|
||||
}
|
||||
// Do this after stopping all tracks with EndTrack()
|
||||
mSourceStream->Finish();
|
||||
// the TrackUnion destination of the port will autofinish
|
||||
|
||||
nsRefPtr<GetUserMediaNotificationEvent> event =
|
||||
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STOPPING);
|
||||
@ -192,14 +190,12 @@ class GetUserMediaCallbackMediaStreamListener : public MediaStreamListener
|
||||
public:
|
||||
GetUserMediaCallbackMediaStreamListener(nsIThread *aThread,
|
||||
nsDOMMediaStream* aStream,
|
||||
already_AddRefed<MediaInputPort> aPort,
|
||||
MediaEngineSource* aAudioSource,
|
||||
MediaEngineSource* aVideoSource)
|
||||
: mMediaThread(aThread)
|
||||
, mAudioSource(aAudioSource)
|
||||
, mVideoSource(aVideoSource)
|
||||
, mStream(aStream)
|
||||
, mPort(aPort) {}
|
||||
, mStream(aStream) {}
|
||||
|
||||
void
|
||||
Invalidate()
|
||||
@ -210,7 +206,7 @@ public:
|
||||
// thread.
|
||||
// XXX FIX! I'm cheating and passing a raw pointer to the sourcestream
|
||||
// which is valid as long as the mStream pointer here is. Need a better solution.
|
||||
runnable = new MediaOperationRunnable(MEDIA_STOP,
|
||||
runnable = new MediaOperationRunnable(MEDIA_STOP,
|
||||
mStream->GetStream()->AsSourceStream(),
|
||||
mAudioSource, mVideoSource);
|
||||
mMediaThread->Dispatch(runnable, NS_DISPATCH_NORMAL);
|
||||
@ -243,7 +239,6 @@ private:
|
||||
nsRefPtr<MediaEngineSource> mAudioSource;
|
||||
nsRefPtr<MediaEngineSource> mVideoSource;
|
||||
nsRefPtr<nsDOMMediaStream> mStream;
|
||||
nsRefPtr<MediaInputPort> mPort;
|
||||
};
|
||||
|
||||
typedef nsTArray<nsRefPtr<GetUserMediaCallbackMediaStreamListener> > StreamListeners;
|
||||
|
Loading…
Reference in New Issue
Block a user