зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1651745 - Change MediaEngineSource::SetTrack to take a MediaTrack base class. r=padenot
This allows us to pass in different sub classes, which the next patch will do. Differential Revision: https://phabricator.services.mozilla.com/D95933
This commit is contained in:
Родитель
3b3ae5f371
Коммит
b8cbd64557
|
@ -1123,7 +1123,7 @@ nsresult MediaDevice::Allocate(const MediaTrackConstraints& aConstraints,
|
|||
return mSource->Allocate(aConstraints, aPrefs, aWindowID, aOutBadConstraint);
|
||||
}
|
||||
|
||||
void MediaDevice::SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void MediaDevice::SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipalHandle) {
|
||||
MOZ_ASSERT(MediaManager::IsInMediaThread());
|
||||
MOZ_ASSERT(mSource);
|
||||
|
@ -4166,25 +4166,25 @@ SourceListener::InitializeAsync() {
|
|||
[principal = GetPrincipalHandle(),
|
||||
audioDevice =
|
||||
mAudioDeviceState ? mAudioDeviceState->mDevice : nullptr,
|
||||
audioStream = mAudioDeviceState
|
||||
? mAudioDeviceState->mTrackSource->mTrack
|
||||
: nullptr,
|
||||
audioTrack = mAudioDeviceState
|
||||
? mAudioDeviceState->mTrackSource->mTrack
|
||||
: nullptr,
|
||||
audioDeviceMuted =
|
||||
mAudioDeviceState ? mAudioDeviceState->mDeviceMuted : false,
|
||||
videoDevice =
|
||||
mVideoDeviceState ? mVideoDeviceState->mDevice : nullptr,
|
||||
videoStream = mVideoDeviceState
|
||||
? mVideoDeviceState->mTrackSource->mTrack
|
||||
: nullptr,
|
||||
videoTrack = mVideoDeviceState
|
||||
? mVideoDeviceState->mTrackSource->mTrack
|
||||
: nullptr,
|
||||
videoDeviceMuted =
|
||||
mVideoDeviceState ? mVideoDeviceState->mDeviceMuted : false](
|
||||
MozPromiseHolder<SourceListenerPromise>& aHolder) {
|
||||
if (audioDevice) {
|
||||
audioDevice->SetTrack(audioStream->AsSourceTrack(), principal);
|
||||
audioDevice->SetTrack(audioTrack, principal);
|
||||
}
|
||||
|
||||
if (videoDevice) {
|
||||
videoDevice->SetTrack(videoStream->AsSourceTrack(), principal);
|
||||
videoDevice->SetTrack(videoTrack, principal);
|
||||
}
|
||||
|
||||
if (audioDevice) {
|
||||
|
|
|
@ -87,7 +87,7 @@ class MediaDevice : public nsIMediaDevice {
|
|||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, uint64_t aWindowId,
|
||||
const char** aOutBadConstraint);
|
||||
void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal);
|
||||
nsresult Start();
|
||||
nsresult Reconfigure(const dom::MediaTrackConstraints& aConstraints,
|
||||
|
|
|
@ -37,7 +37,7 @@ class MockMediaEngineSource : public MediaEngineSource {
|
|||
nsresult(const dom::MediaTrackConstraints&,
|
||||
const MediaEnginePrefs&, uint64_t, const char**));
|
||||
MOCK_METHOD2(SetTrack,
|
||||
void(const RefPtr<SourceMediaTrack>&, const PrincipalHandle&));
|
||||
void(const RefPtr<MediaTrack>&, const PrincipalHandle&));
|
||||
MOCK_METHOD0(Start, nsresult());
|
||||
MOCK_METHOD3(Reconfigure, nsresult(const dom::MediaTrackConstraints&,
|
||||
const MediaEnginePrefs&, const char**));
|
||||
|
|
|
@ -221,13 +221,14 @@ static void ReleaseFrame(layers::PlanarYCbCrData& aData) {
|
|||
}
|
||||
|
||||
void MediaEngineDefaultVideoSource::SetTrack(
|
||||
const RefPtr<SourceMediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
const RefPtr<MediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
MOZ_ASSERT(mState == kAllocated);
|
||||
MOZ_ASSERT(!mTrack);
|
||||
MOZ_ASSERT(aTrack->AsSourceTrack());
|
||||
|
||||
mTrack = aTrack;
|
||||
mTrack = aTrack->AsSourceTrack();
|
||||
mPrincipalHandle = aPrincipal;
|
||||
}
|
||||
|
||||
|
@ -431,13 +432,14 @@ nsresult MediaEngineDefaultAudioSource::Deallocate() {
|
|||
}
|
||||
|
||||
void MediaEngineDefaultAudioSource::SetTrack(
|
||||
const RefPtr<SourceMediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
const RefPtr<MediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
MOZ_ASSERT(mState == kAllocated);
|
||||
MOZ_ASSERT(!mTrack);
|
||||
MOZ_ASSERT(aTrack->AsSourceTrack());
|
||||
|
||||
mTrack = aTrack;
|
||||
mTrack = aTrack->AsSourceTrack();
|
||||
mPrincipalHandle = aPrincipal;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class MediaEngineDefaultVideoSource : public MediaEngineSource {
|
|||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, uint64_t aWindowID,
|
||||
const char** aOutBadConstraint) override;
|
||||
void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) override;
|
||||
nsresult Start() override;
|
||||
nsresult Reconfigure(const dom::MediaTrackConstraints& aConstraints,
|
||||
|
@ -104,7 +104,7 @@ class MediaEngineDefaultAudioSource : public MediaEngineSource {
|
|||
nsresult Allocate(const dom::MediaTrackConstraints& aConstraints,
|
||||
const MediaEnginePrefs& aPrefs, uint64_t aWindowID,
|
||||
const char** aOutBadConstraint) override;
|
||||
void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) override;
|
||||
nsresult Start() override;
|
||||
nsresult Reconfigure(const dom::MediaTrackConstraints& aConstraints,
|
||||
|
|
|
@ -263,14 +263,15 @@ nsresult MediaEngineRemoteVideoSource::Deallocate() {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void MediaEngineRemoteVideoSource::SetTrack(
|
||||
const RefPtr<SourceMediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
void MediaEngineRemoteVideoSource::SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) {
|
||||
LOG("%s", __PRETTY_FUNCTION__);
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
MOZ_ASSERT(mState == kAllocated);
|
||||
MOZ_ASSERT(!mTrack);
|
||||
MOZ_ASSERT(aTrack);
|
||||
MOZ_ASSERT(aTrack->AsSourceTrack());
|
||||
|
||||
if (!mImageContainer) {
|
||||
mImageContainer = layers::LayerManager::CreateImageContainer(
|
||||
|
@ -279,7 +280,7 @@ void MediaEngineRemoteVideoSource::SetTrack(
|
|||
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
mTrack = aTrack;
|
||||
mTrack = aTrack->AsSourceTrack();
|
||||
mPrincipal = aPrincipal;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ class MediaEngineRemoteVideoSource : public MediaEngineSource,
|
|||
const MediaEnginePrefs& aPrefs, uint64_t aWindowID,
|
||||
const char** aOutBadConstraint) override;
|
||||
nsresult Deallocate() override;
|
||||
void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) override;
|
||||
nsresult Start() override;
|
||||
nsresult Reconfigure(const dom::MediaTrackConstraints& aConstraints,
|
||||
|
|
|
@ -28,7 +28,7 @@ class PrincipalInfo;
|
|||
|
||||
class MediaEnginePhotoCallback;
|
||||
class MediaEnginePrefs;
|
||||
class SourceMediaTrack;
|
||||
class MediaTrack;
|
||||
|
||||
/**
|
||||
* Callback interface for TakePhoto(). Either PhotoComplete() or PhotoError()
|
||||
|
@ -113,12 +113,12 @@ class MediaEngineSourceInterface {
|
|||
const char** aOutBadConstraint) = 0;
|
||||
|
||||
/**
|
||||
* Called by MediaEngine when a SourceMediaTrack has been provided for the
|
||||
* source to feed data to.
|
||||
* Called by MediaEngine when a MediaTrack has been provided for the source to
|
||||
* feed data to.
|
||||
*
|
||||
* This must be called before Start.
|
||||
*/
|
||||
virtual void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
virtual void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -489,13 +489,14 @@ nsresult MediaEngineWebRTCMicrophoneSource::Deallocate() {
|
|||
}
|
||||
|
||||
void MediaEngineWebRTCMicrophoneSource::SetTrack(
|
||||
const RefPtr<SourceMediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
const RefPtr<MediaTrack>& aTrack, const PrincipalHandle& aPrincipal) {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(aTrack);
|
||||
MOZ_ASSERT(aTrack->AsSourceTrack());
|
||||
|
||||
MOZ_ASSERT(!mTrack);
|
||||
MOZ_ASSERT(mPrincipal == PRINCIPAL_HANDLE_NONE);
|
||||
mTrack = aTrack;
|
||||
mTrack = aTrack->AsSourceTrack();
|
||||
mPrincipal = aPrincipal;
|
||||
|
||||
mInputProcessing =
|
||||
|
@ -1199,8 +1200,7 @@ nsString MediaEngineWebRTCAudioCaptureSource::GetGroupId() const {
|
|||
}
|
||||
|
||||
void MediaEngineWebRTCAudioCaptureSource::SetTrack(
|
||||
const RefPtr<SourceMediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipalHandle) {
|
||||
const RefPtr<MediaTrack>& aTrack, const PrincipalHandle& aPrincipalHandle) {
|
||||
AssertIsOnOwningThread();
|
||||
// Nothing to do here. aTrack is a placeholder dummy and not exposed.
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class MediaEngineWebRTCMicrophoneSource : public MediaEngineSource {
|
|||
const MediaEnginePrefs& aPrefs, uint64_t aWindowID,
|
||||
const char** aOutBadConstraint) override;
|
||||
nsresult Deallocate() override;
|
||||
void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) override;
|
||||
nsresult Start() override;
|
||||
nsresult Stop() override;
|
||||
|
@ -291,7 +291,7 @@ class MediaEngineWebRTCAudioCaptureSource : public MediaEngineSource {
|
|||
// Nothing to do here, everything is managed in MediaManager.cpp
|
||||
return NS_OK;
|
||||
}
|
||||
void SetTrack(const RefPtr<SourceMediaTrack>& aTrack,
|
||||
void SetTrack(const RefPtr<MediaTrack>& aTrack,
|
||||
const PrincipalHandle& aPrincipal) override;
|
||||
nsresult Start() override;
|
||||
nsresult Stop() override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче