Bug 1513973 - Make MediaEngineSource::SetTrack return void. r=jib

All subclasses are now returning NS_OK, so there's no point in keeping nsresult
as the return type.

Differential Revision: https://phabricator.services.mozilla.com/D15193

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Pehrson 2019-01-04 06:39:40 +00:00
Родитель de06fc1905
Коммит d8bf65f800
11 изменённых файлов: 38 добавлений и 51 удалений

Просмотреть файл

@ -976,13 +976,12 @@ nsresult MediaDevice::Allocate(const dom::MediaTrackConstraints& aConstraints,
aOutBadConstraint);
}
nsresult MediaDevice::SetTrack(const RefPtr<SourceMediaStream>& aStream,
TrackID aTrackID,
const PrincipalHandle& aPrincipalHandle) {
void MediaDevice::SetTrack(const RefPtr<SourceMediaStream>& aStream,
TrackID aTrackID,
const PrincipalHandle& aPrincipalHandle) {
MOZ_ASSERT(MediaManager::IsInMediaThread());
MOZ_ASSERT(mSource);
return mSource->SetTrack(mAllocationHandle, aStream, aTrackID,
aPrincipalHandle);
mSource->SetTrack(mAllocationHandle, aStream, aTrackID, aPrincipalHandle);
}
nsresult MediaDevice::Start() {
@ -4123,11 +4122,8 @@ SourceListener::InitializeAsync() {
mVideoDeviceState ? mVideoDeviceState->mDevice : nullptr](
MozPromiseHolder<SourceListenerPromise>& aHolder) {
if (audioDevice) {
nsresult rv =
audioDevice->SetTrack(stream, kAudioTrack, principal);
if (NS_SUCCEEDED(rv)) {
rv = audioDevice->Start();
}
audioDevice->SetTrack(stream, kAudioTrack, principal);
nsresult rv = audioDevice->Start();
if (NS_FAILED(rv)) {
nsString log;
if (rv == NS_ERROR_NOT_AVAILABLE) {
@ -4147,11 +4143,8 @@ SourceListener::InitializeAsync() {
}
if (videoDevice) {
nsresult rv =
videoDevice->SetTrack(stream, kVideoTrack, principal);
if (NS_SUCCEEDED(rv)) {
rv = videoDevice->Start();
}
videoDevice->SetTrack(stream, kVideoTrack, principal);
nsresult rv = videoDevice->Start();
if (NS_FAILED(rv)) {
if (audioDevice) {
if (NS_WARN_IF(NS_FAILED(audioDevice->Stop()))) {

Просмотреть файл

@ -86,8 +86,8 @@ class MediaDevice : public nsIMediaDevice {
const MediaEnginePrefs& aPrefs,
const mozilla::ipc::PrincipalInfo& aPrincipalInfo,
const char** aOutBadConstraint);
nsresult SetTrack(const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal);
void SetTrack(const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal);
nsresult Start();
nsresult Reconfigure(const dom::MediaTrackConstraints& aConstraints,
const MediaEnginePrefs& aPrefs,

Просмотреть файл

@ -160,7 +160,7 @@ static void ReleaseFrame(layers::PlanarYCbCrData& aData) {
free(aData.mYChannel);
}
nsresult MediaEngineDefaultVideoSource::SetTrack(
void MediaEngineDefaultVideoSource::SetTrack(
const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) {
@ -177,7 +177,6 @@ nsresult MediaEngineDefaultVideoSource::SetTrack(
}
aStream->AddTrack(aTrackID, new VideoSegment(),
SourceMediaStream::ADDTRACK_QUEUED);
return NS_OK;
}
nsresult MediaEngineDefaultVideoSource::Start(
@ -424,7 +423,7 @@ nsresult MediaEngineDefaultAudioSource::Deallocate(
return NS_OK;
}
nsresult MediaEngineDefaultAudioSource::SetTrack(
void MediaEngineDefaultAudioSource::SetTrack(
const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) {
@ -439,7 +438,6 @@ nsresult MediaEngineDefaultAudioSource::SetTrack(
mTrackID = aTrackID;
aStream->AddAudioTrack(aTrackID, aStream->GraphRate(), new AudioSegment(),
SourceMediaStream::ADDTRACK_QUEUED);
return NS_OK;
}
nsresult MediaEngineDefaultAudioSource::Start(

Просмотреть файл

@ -47,9 +47,9 @@ class MediaEngineDefaultVideoSource : public MediaEngineSource {
const ipc::PrincipalInfo& aPrincipalInfo,
AllocationHandle** aOutHandle,
const char** aOutBadConstraint) override;
nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
nsresult Start(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,
const dom::MediaTrackConstraints& aConstraints,
@ -114,9 +114,9 @@ class MediaEngineDefaultAudioSource : public MediaEngineSource {
const ipc::PrincipalInfo& aPrincipalInfo,
AllocationHandle** aOutHandle,
const char** aOutBadConstraint) override;
nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
nsresult Start(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,
const dom::MediaTrackConstraints& aConstraints,

Просмотреть файл

@ -259,7 +259,7 @@ nsresult MediaEngineRemoteVideoSource::Deallocate(
return NS_OK;
}
nsresult MediaEngineRemoteVideoSource::SetTrack(
void MediaEngineRemoteVideoSource::SetTrack(
const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) {
@ -285,7 +285,6 @@ nsresult MediaEngineRemoteVideoSource::SetTrack(
}
aStream->AddTrack(aTrackID, new VideoSegment(),
SourceMediaStream::ADDTRACK_QUEUED);
return NS_OK;
}
nsresult MediaEngineRemoteVideoSource::Start(

Просмотреть файл

@ -124,9 +124,9 @@ class MediaEngineRemoteVideoSource : public MediaEngineSource,
AllocationHandle** aOutHandle,
const char** aOutBadConstraint) override;
nsresult Deallocate(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
nsresult Start(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,
const dom::MediaTrackConstraints& aConstraints,

Просмотреть файл

@ -145,10 +145,10 @@ class MediaEngineSourceInterface {
*
* This must be called before Start for the given AllocationHandle.
*/
virtual nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream,
TrackID aTrackID,
const PrincipalHandle& aPrincipal) = 0;
virtual void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream,
TrackID aTrackID,
const PrincipalHandle& aPrincipal) = 0;
/**
* Called by MediaEngine to start feeding data to the track associated with

Просмотреть файл

@ -193,7 +193,7 @@ nsresult MediaEngineTabVideoSource::Deallocate(
return NS_OK;
}
nsresult MediaEngineTabVideoSource::SetTrack(
void MediaEngineTabVideoSource::SetTrack(
const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const mozilla::PrincipalHandle& aPrincipal) {
@ -207,7 +207,6 @@ nsresult MediaEngineTabVideoSource::SetTrack(
mStream = aStream;
mTrackID = aTrackID;
mStream->AddTrack(mTrackID, new VideoSegment());
return NS_OK;
}
nsresult MediaEngineTabVideoSource::Start(

Просмотреть файл

@ -30,9 +30,9 @@ class MediaEngineTabVideoSource : public MediaEngineSource {
AllocationHandle** aOutHandle,
const char** aOutBadConstraint) override;
nsresult Deallocate(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
nsresult Start(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,
const dom::MediaTrackConstraints& aConstraints,

Просмотреть файл

@ -503,7 +503,7 @@ nsresult MediaEngineWebRTCMicrophoneSource::Deallocate(
return NS_OK;
}
nsresult MediaEngineWebRTCMicrophoneSource::SetTrack(
void MediaEngineWebRTCMicrophoneSource::SetTrack(
const RefPtr<const AllocationHandle>&,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) {
@ -524,7 +524,6 @@ nsresult MediaEngineWebRTCMicrophoneSource::SetTrack(
SourceMediaStream::ADDTRACK_QUEUED);
LOG("Stream %p registered for microphone capture", aStream.get());
return NS_OK;
}
class StartStopMessage : public ControlMessage {
@ -1160,13 +1159,12 @@ nsCString MediaEngineWebRTCAudioCaptureSource::GetUUID() const {
return nsCString(Substring(asciiString, 1, NSID_LENGTH - 3));
}
nsresult MediaEngineWebRTCAudioCaptureSource::SetTrack(
void MediaEngineWebRTCAudioCaptureSource::SetTrack(
const RefPtr<const AllocationHandle>&,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipalHandle) {
AssertIsOnOwningThread();
// Nothing to do here. aStream is a placeholder dummy and not exposed.
return NS_OK;
}
nsresult MediaEngineWebRTCAudioCaptureSource::Start(

Просмотреть файл

@ -43,9 +43,9 @@ class MediaEngineWebRTCMicrophoneSource : public MediaEngineSource {
AllocationHandle** aOutHandle,
const char** aOutBadConstraint) override;
nsresult Deallocate(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
nsresult Start(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Stop(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,
@ -269,9 +269,9 @@ class MediaEngineWebRTCAudioCaptureSource : public MediaEngineSource {
MOZ_ASSERT(!aHandle);
return NS_OK;
}
nsresult SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
void SetTrack(const RefPtr<const AllocationHandle>& aHandle,
const RefPtr<SourceMediaStream>& aStream, TrackID aTrackID,
const PrincipalHandle& aPrincipal) override;
nsresult Start(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Stop(const RefPtr<const AllocationHandle>& aHandle) override;
nsresult Reconfigure(const RefPtr<AllocationHandle>& aHandle,