зеркало из https://github.com/mozilla/gecko-dev.git
Bug 842415 - Signaling code - replace PR_Lock calls with MutexAutoLock r=jesup
This commit is contained in:
Родитель
df4a6ddf5d
Коммит
8b39436934
|
@ -162,13 +162,12 @@ PeerConnectionMedia::AddStream(nsIDOMMediaStream* aMediaStream, uint32_t *stream
|
|||
// allow one of each.
|
||||
// TODO(ekr@rtfm.com): remove this when multiple of each stream
|
||||
// is allowed
|
||||
PR_Lock(mLocalSourceStreamsLock);
|
||||
mozilla::MutexAutoLock lock(mLocalSourceStreamsLock);
|
||||
for (uint32_t u = 0; u < mLocalSourceStreams.Length(); u++) {
|
||||
nsRefPtr<LocalSourceStreamInfo> localSourceStream = mLocalSourceStreams[u];
|
||||
|
||||
if (localSourceStream->GetMediaStream()->GetHintContents() & hints) {
|
||||
CSFLogError(logTag, "Only one stream of any given type allowed");
|
||||
PR_Unlock(mLocalSourceStreamsLock);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +187,6 @@ PeerConnectionMedia::AddStream(nsIDOMMediaStream* aMediaStream, uint32_t *stream
|
|||
|
||||
mLocalSourceStreams.AppendElement(localSourceStream);
|
||||
|
||||
PR_Unlock(mLocalSourceStreamsLock);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -201,17 +199,15 @@ PeerConnectionMedia::RemoveStream(nsIDOMMediaStream* aMediaStream, uint32_t *str
|
|||
|
||||
CSFLogDebugS(logTag, __FUNCTION__ << ": MediaStream: " << static_cast<void*>(aMediaStream));
|
||||
|
||||
PR_Lock(mLocalSourceStreamsLock);
|
||||
mozilla::MutexAutoLock lock(mLocalSourceStreamsLock);
|
||||
for (uint32_t u = 0; u < mLocalSourceStreams.Length(); u++) {
|
||||
nsRefPtr<LocalSourceStreamInfo> localSourceStream = mLocalSourceStreams[u];
|
||||
if (localSourceStream->GetMediaStream() == stream) {
|
||||
*stream_id = u;
|
||||
PR_Unlock(mLocalSourceStreamsLock);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
PR_Unlock(mLocalSourceStreamsLock);
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -238,11 +238,10 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
|||
public:
|
||||
PeerConnectionMedia(PeerConnectionImpl *parent)
|
||||
: mParent(parent),
|
||||
mLocalSourceStreamsLock(PR_NewLock()),
|
||||
mLocalSourceStreamsLock("PeerConnectionMedia.mLocalSourceStreamsLock"),
|
||||
mIceCtx(NULL) {}
|
||||
|
||||
~PeerConnectionMedia() {
|
||||
PR_DestroyLock(mLocalSourceStreamsLock);
|
||||
}
|
||||
|
||||
nsresult Init(const std::vector<mozilla::NrIceStunServer>& stun_servers);
|
||||
|
@ -345,11 +344,10 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
|||
PeerConnectionImpl *mParent;
|
||||
|
||||
// A list of streams returned from GetUserMedia
|
||||
PRLock *mLocalSourceStreamsLock;
|
||||
mozilla::Mutex mLocalSourceStreamsLock;
|
||||
nsTArray<nsRefPtr<LocalSourceStreamInfo> > mLocalSourceStreams;
|
||||
|
||||
// A list of streams provided by the other side
|
||||
PRLock *mRemoteSourceStreamsLock;
|
||||
nsTArray<nsRefPtr<RemoteSourceStreamInfo> > mRemoteSourceStreams;
|
||||
|
||||
// ICE objects
|
||||
|
|
Загрузка…
Ссылка в новой задаче