зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 0fc93ec9ccd7 (bug 1213517)
This commit is contained in:
Родитель
49a7efff23
Коммит
725d265c2c
|
@ -16,9 +16,8 @@ class AudioStreamTrack : public MediaStreamTrack {
|
|||
public:
|
||||
AudioStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
|
||||
TrackID aInputTrackID,
|
||||
MediaStreamTrackSource* aSource,
|
||||
const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
|
||||
: MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource, aConstraints) {}
|
||||
MediaStreamTrackSource* aSource)
|
||||
: MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource) {}
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
@ -36,8 +35,7 @@ protected:
|
|||
return do_AddRef(new AudioStreamTrack(aOwningStream,
|
||||
aTrackID,
|
||||
mInputTrackID,
|
||||
mSource,
|
||||
mConstraints));
|
||||
mSource));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -979,8 +979,7 @@ DOMMediaStream::RemovePrincipalChangeObserver(
|
|||
|
||||
MediaStreamTrack*
|
||||
DOMMediaStream::CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
|
||||
MediaStreamTrackSource* aSource,
|
||||
const MediaTrackConstraints& aConstraints)
|
||||
MediaStreamTrackSource* aSource)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(mInputStream);
|
||||
MOZ_RELEASE_ASSERT(mOwnedStream);
|
||||
|
@ -990,10 +989,10 @@ DOMMediaStream::CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
|
|||
MediaStreamTrack* track;
|
||||
switch (aType) {
|
||||
case MediaSegment::AUDIO:
|
||||
track = new AudioStreamTrack(this, aTrackID, aTrackID, aSource, aConstraints);
|
||||
track = new AudioStreamTrack(this, aTrackID, aTrackID, aSource);
|
||||
break;
|
||||
case MediaSegment::VIDEO:
|
||||
track = new VideoStreamTrack(this, aTrackID, aTrackID, aSource, aConstraints);
|
||||
track = new VideoStreamTrack(this, aTrackID, aTrackID, aSource);
|
||||
break;
|
||||
default:
|
||||
MOZ_CRASH("Unhandled track type");
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "StreamTracks.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "MediaTrackConstraints.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "PrincipalChangeObserver.h"
|
||||
|
||||
|
@ -49,6 +48,7 @@ class VideoTrack;
|
|||
class AudioTrackList;
|
||||
class VideoTrackList;
|
||||
class MediaTrackListListener;
|
||||
struct MediaTrackConstraints;
|
||||
} // namespace dom
|
||||
|
||||
namespace layers {
|
||||
|
@ -522,8 +522,7 @@ public:
|
|||
* to be called from an async task.
|
||||
*/
|
||||
MediaStreamTrack* CreateDOMTrack(TrackID aTrackID, MediaSegment::Type aType,
|
||||
MediaStreamTrackSource* aSource,
|
||||
const MediaTrackConstraints& aConstraints = MediaTrackConstraints());
|
||||
MediaStreamTrackSource* aSource);
|
||||
|
||||
/**
|
||||
* Creates a MediaStreamTrack cloned from aTrack, adds it to mTracks and
|
||||
|
|
|
@ -927,18 +927,6 @@ MediaOperationTask::ReturnCallbackError(nsresult rv, const char* errorLog)
|
|||
mWindowID)));
|
||||
}
|
||||
|
||||
static bool
|
||||
IsOn(const OwningBooleanOrMediaTrackConstraints &aUnion) {
|
||||
return !aUnion.IsBoolean() || aUnion.GetAsBoolean();
|
||||
}
|
||||
|
||||
static const MediaTrackConstraints&
|
||||
GetInvariant(const OwningBooleanOrMediaTrackConstraints &aUnion) {
|
||||
static const MediaTrackConstraints empty;
|
||||
return aUnion.IsMediaTrackConstraints() ?
|
||||
aUnion.GetAsMediaTrackConstraints() : empty;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class is only needed since fake tracks are added dynamically.
|
||||
* Instead of refactoring to add them explicitly we let the DOMMediaStream
|
||||
|
@ -1003,12 +991,10 @@ public:
|
|||
uint64_t aWindowID,
|
||||
GetUserMediaCallbackMediaStreamListener* aListener,
|
||||
const nsCString& aOrigin,
|
||||
const MediaStreamConstraints& aConstraints,
|
||||
AudioDevice* aAudioDevice,
|
||||
VideoDevice* aVideoDevice,
|
||||
PeerIdentity* aPeerIdentity)
|
||||
: mConstraints(aConstraints)
|
||||
, mAudioDevice(aAudioDevice)
|
||||
: mAudioDevice(aAudioDevice)
|
||||
, mVideoDevice(aVideoDevice)
|
||||
, mWindowID(aWindowID)
|
||||
, mListener(aListener)
|
||||
|
@ -1178,9 +1164,7 @@ public:
|
|||
RefPtr<MediaStreamTrackSource> audioSource =
|
||||
new LocalTrackSource(principal, audioDeviceName, mListener, source,
|
||||
kAudioTrack, mPeerIdentity);
|
||||
MOZ_ASSERT(IsOn(mConstraints.mAudio));
|
||||
domStream->CreateDOMTrack(kAudioTrack, MediaSegment::AUDIO, audioSource,
|
||||
GetInvariant(mConstraints.mAudio));
|
||||
domStream->CreateDOMTrack(kAudioTrack, MediaSegment::AUDIO, audioSource);
|
||||
}
|
||||
if (mVideoDevice) {
|
||||
nsString videoDeviceName;
|
||||
|
@ -1190,9 +1174,7 @@ public:
|
|||
RefPtr<MediaStreamTrackSource> videoSource =
|
||||
new LocalTrackSource(principal, videoDeviceName, mListener, source,
|
||||
kVideoTrack, mPeerIdentity);
|
||||
MOZ_ASSERT(IsOn(mConstraints.mVideo));
|
||||
domStream->CreateDOMTrack(kVideoTrack, MediaSegment::VIDEO, videoSource,
|
||||
GetInvariant(mConstraints.mVideo));
|
||||
domStream->CreateDOMTrack(kVideoTrack, MediaSegment::VIDEO, videoSource);
|
||||
}
|
||||
stream = domStream->GetInputStream()->AsSourceStream();
|
||||
}
|
||||
|
@ -1246,7 +1228,6 @@ public:
|
|||
private:
|
||||
nsCOMPtr<nsIDOMGetUserMediaSuccessCallback> mOnSuccess;
|
||||
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> mOnFailure;
|
||||
MediaStreamConstraints mConstraints;
|
||||
RefPtr<AudioDevice> mAudioDevice;
|
||||
RefPtr<VideoDevice> mVideoDevice;
|
||||
uint64_t mWindowID;
|
||||
|
@ -1256,6 +1237,18 @@ private:
|
|||
RefPtr<MediaManager> mManager; // get ref to this when creating the runnable
|
||||
};
|
||||
|
||||
static bool
|
||||
IsOn(const OwningBooleanOrMediaTrackConstraints &aUnion) {
|
||||
return !aUnion.IsBoolean() || aUnion.GetAsBoolean();
|
||||
}
|
||||
|
||||
static const MediaTrackConstraints&
|
||||
GetInvariant(const OwningBooleanOrMediaTrackConstraints &aUnion) {
|
||||
static const MediaTrackConstraints empty;
|
||||
return aUnion.IsMediaTrackConstraints() ?
|
||||
aUnion.GetAsMediaTrackConstraints() : empty;
|
||||
}
|
||||
|
||||
// Source getter returning full list
|
||||
|
||||
template<class DeviceType>
|
||||
|
@ -1458,9 +1451,8 @@ public:
|
|||
|
||||
NS_DispatchToMainThread(do_AddRef(
|
||||
new GetUserMediaStreamRunnable(mOnSuccess, mOnFailure, mWindowID,
|
||||
mListener, mOrigin, mConstraints,
|
||||
mAudioDevice, mVideoDevice,
|
||||
peerIdentity)));
|
||||
mListener, mOrigin, mAudioDevice,
|
||||
mVideoDevice, peerIdentity)));
|
||||
MOZ_ASSERT(!mOnSuccess);
|
||||
MOZ_ASSERT(!mOnFailure);
|
||||
return NS_OK;
|
||||
|
|
|
@ -110,14 +110,12 @@ protected:
|
|||
|
||||
MediaStreamTrack::MediaStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
|
||||
TrackID aInputTrackID,
|
||||
MediaStreamTrackSource* aSource,
|
||||
const MediaTrackConstraints& aConstraints)
|
||||
MediaStreamTrackSource* aSource)
|
||||
: mOwningStream(aStream), mTrackID(aTrackID),
|
||||
mInputTrackID(aInputTrackID), mSource(aSource),
|
||||
mPrincipal(aSource->GetPrincipal()),
|
||||
mReadyState(MediaStreamTrackState::Live),
|
||||
mEnabled(true), mRemote(aSource->IsRemote()),
|
||||
mConstraints(aConstraints)
|
||||
mEnabled(true), mRemote(aSource->IsRemote())
|
||||
{
|
||||
|
||||
if (!gMediaStreamTrackLog) {
|
||||
|
|
|
@ -132,7 +132,7 @@ public:
|
|||
*/
|
||||
virtual already_AddRefed<PledgeVoid>
|
||||
ApplyConstraints(nsPIDOMWindowInner* aWindow,
|
||||
const dom::MediaTrackConstraints& aConstraints);
|
||||
const dom::MediaTrackConstraints& aConstraints) = 0;
|
||||
|
||||
/**
|
||||
* Called by the source interface when all registered sinks have unregistered.
|
||||
|
@ -213,6 +213,13 @@ public:
|
|||
|
||||
MediaSourceEnum GetMediaSource() const override { return mMediaSource; }
|
||||
|
||||
already_AddRefed<PledgeVoid>
|
||||
ApplyConstraints(nsPIDOMWindowInner* aWindow,
|
||||
const dom::MediaTrackConstraints& aConstraints) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Stop() override {}
|
||||
|
||||
protected:
|
||||
|
@ -245,9 +252,8 @@ public:
|
|||
* MediaStream owned by aStream.
|
||||
*/
|
||||
MediaStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
|
||||
TrackID aInputTrackID,
|
||||
MediaStreamTrackSource* aSource,
|
||||
const MediaTrackConstraints& aConstraints = MediaTrackConstraints());
|
||||
TrackID aInputTrackID,
|
||||
MediaStreamTrackSource* aSource);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaStreamTrack,
|
||||
|
|
|
@ -16,9 +16,8 @@ class VideoStreamTrack : public MediaStreamTrack {
|
|||
public:
|
||||
VideoStreamTrack(DOMMediaStream* aStream, TrackID aTrackID,
|
||||
TrackID aInputTrackID,
|
||||
MediaStreamTrackSource* aSource,
|
||||
const MediaTrackConstraints& aConstraints = MediaTrackConstraints())
|
||||
: MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource, aConstraints) {}
|
||||
MediaStreamTrackSource* aSource)
|
||||
: MediaStreamTrack(aStream, aTrackID, aInputTrackID, aSource) {}
|
||||
|
||||
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
@ -36,8 +35,7 @@ protected:
|
|||
return do_AddRef(new VideoStreamTrack(aOwningStream,
|
||||
aTrackID,
|
||||
mInputTrackID,
|
||||
mSource,
|
||||
mConstraints));
|
||||
mSource));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -40,8 +40,7 @@ MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AudioContext* a
|
|||
new BasicUnstoppableTrackSource(doc->NodePrincipal(),
|
||||
MediaSourceEnum::AudioCapture);
|
||||
mDOMStream->CreateDOMTrack(AudioNodeStream::AUDIO_TRACK,
|
||||
MediaSegment::AUDIO, source,
|
||||
MediaTrackConstraints());
|
||||
MediaSegment::AUDIO, source);
|
||||
|
||||
ProcessedMediaStream* outputStream = mDOMStream->GetInputStream()->AsProcessedStream();
|
||||
MOZ_ASSERT(!!outputStream);
|
||||
|
|
Загрузка…
Ссылка в новой задаче