mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 994912 - Add support for event-based notifications to media streams. r=roc,bz
This commit is contained in:
parent
7ac0e7b724
commit
df9a7f17e9
@ -18,10 +18,10 @@
|
||||
#define RTSPURI_SCHEME "rtsp"
|
||||
|
||||
class nsIDOMBlob;
|
||||
class nsIDOMMediaStream;
|
||||
class nsIPrincipal;
|
||||
|
||||
namespace mozilla {
|
||||
class DOMMediaStream;
|
||||
namespace dom {
|
||||
class MediaSource;
|
||||
}
|
||||
@ -122,7 +122,7 @@ extern nsresult
|
||||
NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream);
|
||||
|
||||
extern nsresult
|
||||
NS_GetStreamForMediaStreamURI(nsIURI* aURI, nsIDOMMediaStream** aStream);
|
||||
NS_GetStreamForMediaStreamURI(nsIURI* aURI, mozilla::DOMMediaStream** aStream);
|
||||
|
||||
extern nsresult
|
||||
NS_GetSourceForMediaSourceURI(nsIURI* aURI, mozilla::dom::MediaSource** aSource);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsDOMFile.h"
|
||||
#include "nsIDOMMediaStream.h"
|
||||
#include "DOMMediaStream.h"
|
||||
#include "mozilla/dom/MediaSource.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -24,7 +24,7 @@ using mozilla::LoadInfo;
|
||||
// Hash table
|
||||
struct DataInfo
|
||||
{
|
||||
// mObject is expected to be an nsIDOMBlob, nsIDOMMediaStream, or MediaSource
|
||||
// mObject is expected to be an nsIDOMBlob, DOMMediaStream, or MediaSource
|
||||
nsCOMPtr<nsISupports> mObject;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCString mStack;
|
||||
@ -605,20 +605,17 @@ NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream)
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_GetStreamForMediaStreamURI(nsIURI* aURI, nsIDOMMediaStream** aStream)
|
||||
NS_GetStreamForMediaStreamURI(nsIURI* aURI, mozilla::DOMMediaStream** aStream)
|
||||
{
|
||||
NS_ASSERTION(IsMediaStreamURI(aURI), "Only call this with mediastream URIs");
|
||||
|
||||
*aStream = nullptr;
|
||||
|
||||
nsCOMPtr<nsIDOMMediaStream> stream = do_QueryInterface(GetDataObject(aURI));
|
||||
if (!stream) {
|
||||
nsresult rv = CallQueryInterface(GetDataObject(aURI), aStream);
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
*aStream = stream;
|
||||
NS_ADDREF(*aStream);
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -527,6 +527,7 @@ public:
|
||||
already_AddRefed<DOMMediaStream> GetMozSrcObject() const;
|
||||
|
||||
void SetMozSrcObject(DOMMediaStream& aValue);
|
||||
void SetMozSrcObject(DOMMediaStream* aValue);
|
||||
|
||||
bool MozPreservesPitch() const
|
||||
{
|
||||
|
@ -509,14 +509,6 @@ HTMLMediaElement::GetMozSrcObject() const
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLMediaElement::GetMozSrcObject(nsIDOMMediaStream** aStream)
|
||||
{
|
||||
nsRefPtr<DOMMediaStream> stream = GetMozSrcObject();
|
||||
stream.forget(aStream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLMediaElement::SetMozSrcObject(DOMMediaStream& aValue)
|
||||
{
|
||||
@ -524,12 +516,10 @@ HTMLMediaElement::SetMozSrcObject(DOMMediaStream& aValue)
|
||||
Load();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLMediaElement::SetMozSrcObject(nsIDOMMediaStream* aStream)
|
||||
void
|
||||
HTMLMediaElement::SetMozSrcObject(DOMMediaStream* aValue)
|
||||
{
|
||||
DOMMediaStream* stream = static_cast<DOMMediaStream*>(aStream);
|
||||
SetMozSrcObject(*stream);
|
||||
return NS_OK;
|
||||
SetMozSrcObject(*aValue);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMHTMLMediaElement mozAutoplayEnabled; */
|
||||
@ -1144,7 +1134,7 @@ nsresult HTMLMediaElement::LoadResource()
|
||||
}
|
||||
|
||||
if (IsMediaStreamURI(mLoadingSrc)) {
|
||||
nsCOMPtr<nsIDOMMediaStream> stream;
|
||||
nsRefPtr<DOMMediaStream> stream;
|
||||
rv = NS_GetStreamForMediaStreamURI(mLoadingSrc, getter_AddRefs(stream));
|
||||
if (NS_FAILED(rv)) {
|
||||
nsCString specUTF8;
|
||||
@ -1154,7 +1144,7 @@ nsresult HTMLMediaElement::LoadResource()
|
||||
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
|
||||
return rv;
|
||||
}
|
||||
SetupSrcMediaStreamPlayback(static_cast<DOMMediaStream*>(stream.get()));
|
||||
SetupSrcMediaStreamPlayback(stream);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1873,13 +1863,6 @@ HTMLMediaElement::MozCaptureStream(ErrorResult& aRv)
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::MozCaptureStream(nsIDOMMediaStream** aStream)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aStream = MozCaptureStream(rv).take();
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
already_AddRefed<DOMMediaStream>
|
||||
HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv)
|
||||
{
|
||||
@ -1892,13 +1875,6 @@ HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv)
|
||||
return stream.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::MozCaptureStreamUntilEnded(nsIDOMMediaStream** aStream)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aStream = MozCaptureStreamUntilEnded(rv).take();
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP HTMLMediaElement::GetMozAudioCaptured(bool* aCaptured)
|
||||
{
|
||||
*aCaptured = MozAudioCaptured();
|
||||
|
@ -19,34 +19,20 @@
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMMediaStream)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaStream)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMMediaStream,
|
||||
DOMEventTargetHelper,
|
||||
mWindow,
|
||||
mTracks,
|
||||
mConsumersToKeepAlive);
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMMediaStream)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMMediaStream)
|
||||
NS_IMPL_ADDREF_INHERITED(DOMMediaStream, DOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(DOMMediaStream, DOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(DOMMediaStream)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DOMMediaStream)
|
||||
NS_INTERFACE_MAP_ENTRY(DOMMediaStream)
|
||||
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(DOMMediaStream)
|
||||
tmp->Destroy();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTracks)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mConsumersToKeepAlive)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMMediaStream)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTracks)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConsumersToKeepAlive)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(DOMMediaStream)
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(DOMLocalMediaStream, DOMMediaStream,
|
||||
nsIDOMLocalMediaStream)
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(DOMLocalMediaStream, DOMMediaStream)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(DOMAudioNodeMediaStream, DOMMediaStream,
|
||||
mStreamNode)
|
||||
@ -93,8 +79,12 @@ public:
|
||||
track = stream->GetDOMTrackFor(mID);
|
||||
}
|
||||
if (mEvents & MediaStreamListener::TRACK_EVENT_ENDED) {
|
||||
track->NotifyEnded();
|
||||
stream->NotifyMediaStreamTrackEnded(track);
|
||||
if (track) {
|
||||
track->NotifyEnded();
|
||||
stream->NotifyMediaStreamTrackEnded(track);
|
||||
} else {
|
||||
NS_ERROR("track ended but not found");
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6,13 +6,13 @@
|
||||
#ifndef NSDOMMEDIASTREAM_H_
|
||||
#define NSDOMMEDIASTREAM_H_
|
||||
|
||||
#include "nsIDOMMediaStream.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "StreamBuffer.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/PeerIdentity.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
|
||||
class nsXPCClassInfo;
|
||||
|
||||
@ -48,11 +48,14 @@ class MediaTrackListListener;
|
||||
|
||||
class MediaStreamDirectListener;
|
||||
|
||||
#define NS_DOMMEDIASTREAM_IID \
|
||||
{ 0x8cb65468, 0x66c0, 0x444e, \
|
||||
{ 0x89, 0x9f, 0x89, 0x1d, 0x9e, 0xd2, 0xbe, 0x7c } }
|
||||
|
||||
/**
|
||||
* DOM wrapper for MediaStreams.
|
||||
*/
|
||||
class DOMMediaStream : public nsIDOMMediaStream,
|
||||
public nsWrapperCache
|
||||
class DOMMediaStream : public DOMEventTargetHelper
|
||||
{
|
||||
friend class DOMLocalMediaStream;
|
||||
typedef dom::MediaStreamTrack MediaStreamTrack;
|
||||
@ -69,8 +72,11 @@ public:
|
||||
|
||||
DOMMediaStream();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMMediaStream)
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DOMMediaStream,
|
||||
DOMEventTargetHelper)
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOMMEDIASTREAM_IID)
|
||||
|
||||
nsIDOMWindow* GetParentObject() const
|
||||
{
|
||||
@ -293,13 +299,20 @@ private:
|
||||
nsAutoPtr<PeerIdentity> mPeerIdentity;
|
||||
};
|
||||
|
||||
class DOMLocalMediaStream : public DOMMediaStream,
|
||||
public nsIDOMLocalMediaStream
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(DOMMediaStream,
|
||||
NS_DOMMEDIASTREAM_IID)
|
||||
|
||||
#define NS_DOMLOCALMEDIASTREAM_IID \
|
||||
{ 0xb1437260, 0xec61, 0x4dfa, \
|
||||
{ 0x92, 0x54, 0x04, 0x44, 0xe2, 0xb5, 0x94, 0x9c } }
|
||||
|
||||
class DOMLocalMediaStream : public DOMMediaStream
|
||||
{
|
||||
public:
|
||||
DOMLocalMediaStream() {}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOMLOCALMEDIASTREAM_IID)
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
|
||||
|
||||
@ -323,6 +336,9 @@ protected:
|
||||
virtual ~DOMLocalMediaStream();
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(DOMLocalMediaStream,
|
||||
NS_DOMLOCALMEDIASTREAM_IID)
|
||||
|
||||
class DOMAudioNodeMediaStream : public DOMMediaStream
|
||||
{
|
||||
typedef dom::AudioNode AudioNode;
|
||||
|
@ -935,8 +935,11 @@ NS_IMPL_ISUPPORTS(SpeechRecognition::GetUserMediaSuccessCallback, nsIDOMGetUserM
|
||||
NS_IMETHODIMP
|
||||
SpeechRecognition::GetUserMediaSuccessCallback::OnSuccess(nsISupports* aStream)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLocalMediaStream> localStream = do_QueryInterface(aStream);
|
||||
mRecognition->StartRecording(static_cast<DOMLocalMediaStream*>(localStream.get()));
|
||||
DOMLocalMediaStream *localStream = nullptr;
|
||||
nsresult rv = CallQueryInterface(aStream, &localStream);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mRecognition->StartRecording(localStream);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,6 @@
|
||||
#include "nsIDOMMediaError.idl"
|
||||
#include "nsIDOMTimeRanges.idl"
|
||||
|
||||
interface nsIDOMMediaStream;
|
||||
|
||||
/**
|
||||
* The nsIDOMHTMLMediaElement interface is an interface to be implemented by the HTML
|
||||
* <audio> and <video> elements.
|
||||
@ -35,7 +33,6 @@ interface nsIDOMHTMLMediaElement : nsISupports
|
||||
|
||||
// network state
|
||||
attribute DOMString src;
|
||||
attribute nsIDOMMediaStream mozSrcObject;
|
||||
readonly attribute DOMString currentSrc;
|
||||
const unsigned short NETWORK_EMPTY = 0;
|
||||
const unsigned short NETWORK_IDLE = 1;
|
||||
@ -79,8 +76,6 @@ interface nsIDOMHTMLMediaElement : nsISupports
|
||||
attribute boolean defaultMuted;
|
||||
|
||||
// Mozilla extension: stream capture
|
||||
nsIDOMMediaStream mozCaptureStream();
|
||||
nsIDOMMediaStream mozCaptureStreamUntilEnded();
|
||||
readonly attribute boolean mozAudioCaptured;
|
||||
|
||||
// Mozilla extension: return embedded metadata from the stream as a
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "nsIDOMWindow.idl"
|
||||
#include "nsIPropertyBag2.idl"
|
||||
|
||||
interface nsIDOMMediaStream;
|
||||
interface nsIDOMDataChannel;
|
||||
|
||||
/*
|
||||
|
@ -17,7 +17,6 @@ if CONFIG['MOZ_WEBRTC']:
|
||||
WEBRTC_SIGNALLING_TEST_MANIFESTS += ['tests/mochitest/steeplechase.ini']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIDOMMediaStream.idl',
|
||||
'nsIDOMNavigatorUserMedia.idl',
|
||||
'nsIMediaManager.idl',
|
||||
]
|
||||
|
@ -1,27 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
// undef the GetCurrentTime macro defined in WinBase.h from the MS Platform SDK
|
||||
%{C++
|
||||
#ifdef GetCurrentTime
|
||||
#undef GetCurrentTime
|
||||
#endif
|
||||
%}
|
||||
|
||||
[builtinclass, uuid(3ef760bb-ff19-4dbb-b552-af27ab84b9b8)]
|
||||
interface nsIDOMMediaStream : nsISupports
|
||||
{
|
||||
/* Placeholder interface only; will be removed after further WebIDL conversion.
|
||||
Do not add anything here. */
|
||||
};
|
||||
|
||||
[builtinclass, uuid(dd37150a-9823-4605-ac4c-3516629a8aaf)]
|
||||
interface nsIDOMLocalMediaStream : nsIDOMMediaStream
|
||||
{
|
||||
/* Placeholder interface only; will be removed after further WebIDL conversion.
|
||||
Do not add anything here. */
|
||||
};
|
@ -4,7 +4,6 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIVariant.idl"
|
||||
#include "nsIDOMMediaStream.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(4af2bdb7-1547-4d10-8886-02a78c3c0b83)]
|
||||
interface nsIMediaDevice : nsISupports
|
||||
@ -27,7 +26,7 @@ interface nsIDOMGetUserMediaSuccessCallback : nsISupports
|
||||
{
|
||||
/*
|
||||
* value must be a nsIDOMBlob if picture is true and a
|
||||
* nsIDOMLocalMediaStream if either audio or video are true.
|
||||
* DOMLocalMediaStream if either audio or video are true.
|
||||
*/
|
||||
void onSuccess(in nsISupports value);
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ dictionary MediaStreamConstraints {
|
||||
DOMString? peerIdentity = null;
|
||||
};
|
||||
|
||||
interface MediaStream {
|
||||
interface MediaStream : EventTarget {
|
||||
// readonly attribute DOMString id;
|
||||
sequence<AudioStreamTrack> getAudioTracks();
|
||||
sequence<VideoStreamTrack> getVideoTracks();
|
||||
|
@ -703,7 +703,7 @@ PeerConnectionImpl::GetFingerprintHexValue() const
|
||||
|
||||
|
||||
nsresult
|
||||
PeerConnectionImpl::CreateFakeMediaStream(uint32_t aHint, nsIDOMMediaStream** aRetval)
|
||||
PeerConnectionImpl::CreateFakeMediaStream(uint32_t aHint, DOMMediaStream** aRetval)
|
||||
{
|
||||
MOZ_ASSERT(aRetval);
|
||||
PC_AUTO_ENTER_API_CALL(false);
|
||||
|
@ -54,7 +54,6 @@ class Fake_MediaStreamTrack;
|
||||
#endif
|
||||
|
||||
class nsGlobalWindow;
|
||||
class nsIDOMMediaStream;
|
||||
class nsDOMDataChannel;
|
||||
|
||||
namespace mozilla {
|
||||
@ -289,7 +288,7 @@ public:
|
||||
std::string GetFingerprintHexValue() const;
|
||||
|
||||
// Create a fake media stream
|
||||
nsresult CreateFakeMediaStream(uint32_t hint, nsIDOMMediaStream** retval);
|
||||
nsresult CreateFakeMediaStream(uint32_t hint, mozilla::DOMMediaStream** retval);
|
||||
|
||||
nsPIDOMWindow* GetWindow() const {
|
||||
PC_AUTO_ENTER_API_CALL_NO_CHECK();
|
||||
|
@ -295,7 +295,7 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
|
||||
}
|
||||
|
||||
nsresult
|
||||
PeerConnectionMedia::AddStream(nsIDOMMediaStream* aMediaStream,
|
||||
PeerConnectionMedia::AddStream(DOMMediaStream* aMediaStream,
|
||||
uint32_t hints,
|
||||
uint32_t *stream_id)
|
||||
{
|
||||
@ -306,8 +306,6 @@ PeerConnectionMedia::AddStream(nsIDOMMediaStream* aMediaStream,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
DOMMediaStream* stream = static_cast<DOMMediaStream*>(aMediaStream);
|
||||
|
||||
CSFLogDebug(logTag, "%s: MediaStream: %p", __FUNCTION__, aMediaStream);
|
||||
|
||||
// Adding tracks here based on nsDOMMediaStream expectation settings
|
||||
@ -336,14 +334,14 @@ PeerConnectionMedia::AddStream(nsIDOMMediaStream* aMediaStream,
|
||||
CSFLogError(logTag, "Only one stream of any given type allowed");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (stream == lss->GetMediaStream()) {
|
||||
if (aMediaStream == lss->GetMediaStream()) {
|
||||
localSourceStream = lss;
|
||||
*stream_id = u;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!localSourceStream) {
|
||||
localSourceStream = new LocalSourceStreamInfo(stream, this);
|
||||
localSourceStream = new LocalSourceStreamInfo(aMediaStream, this);
|
||||
mLocalSourceStreams.AppendElement(localSourceStream);
|
||||
*stream_id = mLocalSourceStreams.Length() - 1;
|
||||
}
|
||||
@ -359,21 +357,19 @@ PeerConnectionMedia::AddStream(nsIDOMMediaStream* aMediaStream,
|
||||
}
|
||||
|
||||
nsresult
|
||||
PeerConnectionMedia::RemoveStream(nsIDOMMediaStream* aMediaStream,
|
||||
PeerConnectionMedia::RemoveStream(DOMMediaStream* aMediaStream,
|
||||
uint32_t hints,
|
||||
uint32_t *stream_id)
|
||||
{
|
||||
MOZ_ASSERT(aMediaStream);
|
||||
ASSERT_ON_THREAD(mMainThread);
|
||||
|
||||
DOMMediaStream* stream = static_cast<DOMMediaStream*>(aMediaStream);
|
||||
|
||||
CSFLogDebug(logTag, "%s: MediaStream: %p",
|
||||
__FUNCTION__, aMediaStream);
|
||||
|
||||
for (uint32_t u = 0; u < mLocalSourceStreams.Length(); u++) {
|
||||
nsRefPtr<LocalSourceStreamInfo> localSourceStream = mLocalSourceStreams[u];
|
||||
if (localSourceStream->GetMediaStream() == stream) {
|
||||
if (localSourceStream->GetMediaStream() == aMediaStream) {
|
||||
*stream_id = u;
|
||||
|
||||
if (hints & DOMMediaStream::HINT_CONTENTS_AUDIO) {
|
||||
|
@ -312,11 +312,11 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
|
||||
}
|
||||
|
||||
// Add a stream (main thread only)
|
||||
nsresult AddStream(nsIDOMMediaStream* aMediaStream, uint32_t hints,
|
||||
nsresult AddStream(DOMMediaStream* aMediaStream, uint32_t hints,
|
||||
uint32_t *stream_id);
|
||||
|
||||
// Remove a stream (main thread only)
|
||||
nsresult RemoveStream(nsIDOMMediaStream* aMediaStream,
|
||||
nsresult RemoveStream(DOMMediaStream* aMediaStream,
|
||||
uint32_t hints,
|
||||
uint32_t *stream_id);
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIDOMMediaStream.h"
|
||||
|
||||
class nsIDOMWindow;
|
||||
|
||||
@ -232,7 +231,7 @@ private:
|
||||
const bool mIsVideo;
|
||||
};
|
||||
|
||||
class Fake_DOMMediaStream : public nsIDOMMediaStream
|
||||
class Fake_DOMMediaStream : public nsISupports
|
||||
{
|
||||
protected:
|
||||
virtual ~Fake_DOMMediaStream() {
|
||||
|
@ -17,7 +17,7 @@ static const int AUDIO_BUFFER_SIZE = 1600;
|
||||
static const int NUM_CHANNELS = 2;
|
||||
static const int GRAPH_RATE = 16000;
|
||||
|
||||
NS_IMPL_ISUPPORTS(Fake_DOMMediaStream, nsIDOMMediaStream)
|
||||
NS_IMPL_ISUPPORTS0(Fake_DOMMediaStream)
|
||||
|
||||
// Fake_MediaStream
|
||||
double Fake_MediaStream::StreamTimeToSeconds(mozilla::StreamTime aTime) {
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "nsTArray.h"
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIDOMMediaStream.h"
|
||||
#include "mozilla/dom/PeerConnectionObserverEnumsBinding.h"
|
||||
#include "PeerConnectionImpl.h"
|
||||
#include "nsWeakReference.h"
|
||||
@ -80,7 +79,7 @@ public:
|
||||
virtual NS_IMETHODIMP NotifyDataChannel(nsIDOMDataChannel *channel, ER&) = 0;
|
||||
virtual NS_IMETHODIMP OnStateChange(mozilla::dom::PCObserverStateType state_type, ER&,
|
||||
void* = nullptr) = 0;
|
||||
virtual NS_IMETHODIMP OnAddStream(nsIDOMMediaStream *stream, ER&) = 0;
|
||||
virtual NS_IMETHODIMP OnAddStream(mozilla::DOMMediaStream *stream, ER&) = 0;
|
||||
virtual NS_IMETHODIMP OnRemoveStream(ER&) = 0;
|
||||
virtual NS_IMETHODIMP OnAddTrack(ER&) = 0;
|
||||
virtual NS_IMETHODIMP OnRemoveTrack(ER&) = 0;
|
||||
|
@ -269,7 +269,7 @@ public:
|
||||
NS_IMETHODIMP OnSetRemoteDescriptionError(uint32_t code, const char *msg, ER&);
|
||||
NS_IMETHODIMP NotifyDataChannel(nsIDOMDataChannel *channel, ER&);
|
||||
NS_IMETHODIMP OnStateChange(PCObserverStateType state_type, ER&, void*);
|
||||
NS_IMETHODIMP OnAddStream(nsIDOMMediaStream *stream, ER&);
|
||||
NS_IMETHODIMP OnAddStream(DOMMediaStream *stream, ER&);
|
||||
NS_IMETHODIMP OnRemoveStream(ER&);
|
||||
NS_IMETHODIMP OnAddTrack(ER&);
|
||||
NS_IMETHODIMP OnRemoveTrack(ER&);
|
||||
@ -429,23 +429,21 @@ TestObserver::OnStateChange(PCObserverStateType state_type, ER&, void*)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
TestObserver::OnAddStream(nsIDOMMediaStream *stream, ER&)
|
||||
TestObserver::OnAddStream(DOMMediaStream *stream, ER&)
|
||||
{
|
||||
PR_ASSERT(stream);
|
||||
|
||||
DOMMediaStream *ms = static_cast<DOMMediaStream *>(stream);
|
||||
|
||||
std::cout << name << ": OnAddStream called hints=" << ms->GetHintContents()
|
||||
std::cout << name << ": OnAddStream called hints=" << stream->GetHintContents()
|
||||
<< " thread=" << PR_GetCurrentThread() << std::endl ;
|
||||
|
||||
onAddStreamCalled = true;
|
||||
|
||||
streams.push_back(ms);
|
||||
streams.push_back(stream);
|
||||
|
||||
// We know that the media stream is secretly a Fake_SourceMediaStream,
|
||||
// so now we can start it pulling from us
|
||||
nsRefPtr<Fake_SourceMediaStream> fs =
|
||||
static_cast<Fake_SourceMediaStream *>(ms->GetStream());
|
||||
static_cast<Fake_SourceMediaStream *>(stream->GetStream());
|
||||
|
||||
test_utils->sts_target()->Dispatch(
|
||||
WrapRunnable(fs, &Fake_SourceMediaStream::Start),
|
||||
|
@ -102,7 +102,6 @@
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMediaError.h"
|
||||
#include "nsIDOMMediaList.h"
|
||||
#include "nsIDOMMediaStream.h"
|
||||
#include "nsIDOMMessageEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMMouseScrollEvent.h"
|
||||
@ -236,10 +235,8 @@
|
||||
#include "mozilla/dom/HTMLTitleElementBinding.h"
|
||||
#include "mozilla/dom/HTMLUListElementBinding.h"
|
||||
#include "mozilla/dom/KeyEventBinding.h"
|
||||
#include "mozilla/dom/LocalMediaStreamBinding.h"
|
||||
#include "mozilla/dom/MediaErrorBinding.h"
|
||||
#include "mozilla/dom/MediaListBinding.h"
|
||||
#include "mozilla/dom/MediaStreamBinding.h"
|
||||
#include "mozilla/dom/MessageEventBinding.h"
|
||||
#include "mozilla/dom/MouseEventBinding.h"
|
||||
#include "mozilla/dom/MouseScrollEventBinding.h"
|
||||
@ -425,10 +422,8 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
||||
DEFINE_SHIM(HTMLTitleElement),
|
||||
DEFINE_SHIM(HTMLUListElement),
|
||||
DEFINE_SHIM(KeyEvent),
|
||||
DEFINE_SHIM(LocalMediaStream),
|
||||
DEFINE_SHIM(MediaError),
|
||||
DEFINE_SHIM(MediaList),
|
||||
DEFINE_SHIM(MediaStream),
|
||||
DEFINE_SHIM(MessageEvent),
|
||||
DEFINE_SHIM(MouseEvent),
|
||||
DEFINE_SHIM(MouseScrollEvent),
|
||||
|
Loading…
Reference in New Issue
Block a user