mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset d9bcbec33260 for bustage.
This commit is contained in:
commit
7e6cd9d42b
@ -68,6 +68,7 @@ class GetUserMediaNotificationEvent: public nsRunnable
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
MEDIA_START,
|
MEDIA_START,
|
||||||
MEDIA_STOP,
|
MEDIA_STOP,
|
||||||
|
MEDIA_RELEASE
|
||||||
} MediaOperation;
|
} MediaOperation;
|
||||||
|
|
||||||
// Generic class for running long media operations off the main thread, and
|
// Generic class for running long media operations off the main thread, and
|
||||||
@ -100,21 +101,12 @@ public:
|
|||||||
, mSourceStream(aStream)
|
, mSourceStream(aStream)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~MediaOperationRunnable()
|
|
||||||
{
|
|
||||||
// nsDOMMediaStreams are cycle-collected and thus main-thread-only for
|
|
||||||
// refcounting and releasing
|
|
||||||
if (mStream) {
|
|
||||||
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
|
|
||||||
NS_ProxyRelease(mainThread,mStream,false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
Run()
|
Run()
|
||||||
{
|
{
|
||||||
// No locking between these is required as all the callbacks for the
|
// No locking between these is required as all the callbacks (other
|
||||||
// same MediaStream will occur on the same thread.
|
// than MEDIA_RELEASE) for the same MediaStream will occur on the same
|
||||||
|
// thread.
|
||||||
if (mStream) {
|
if (mStream) {
|
||||||
mSourceStream = mStream->GetStream()->AsSourceStream();
|
mSourceStream = mStream->GetStream()->AsSourceStream();
|
||||||
}
|
}
|
||||||
@ -143,7 +135,6 @@ public:
|
|||||||
nsRefPtr<GetUserMediaNotificationEvent> event =
|
nsRefPtr<GetUserMediaNotificationEvent> event =
|
||||||
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STARTING);
|
new GetUserMediaNotificationEvent(GetUserMediaNotificationEvent::STARTING);
|
||||||
|
|
||||||
|
|
||||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -168,15 +159,23 @@ public:
|
|||||||
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MEDIA_RELEASE:
|
||||||
|
// We go to MainThread to die
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (mType != MEDIA_RELEASE) {
|
||||||
|
// nsDOMMediaStreams aren't thread-safe... sigh.
|
||||||
|
mType = MEDIA_RELEASE;
|
||||||
|
NS_DispatchToMainThread(this);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MediaOperation mType;
|
MediaOperation mType;
|
||||||
nsRefPtr<MediaEngineSource> mAudioSource; // threadsafe
|
nsRefPtr<MediaEngineSource> mAudioSource;
|
||||||
nsRefPtr<MediaEngineSource> mVideoSource; // threadsafe
|
nsRefPtr<MediaEngineSource> mVideoSource;
|
||||||
nsRefPtr<nsDOMMediaStream> mStream; // not threadsafe
|
nsRefPtr<nsDOMMediaStream> mStream;
|
||||||
SourceMediaStream *mSourceStream;
|
SourceMediaStream *mSourceStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user