haikuwebkit/Source/WebCore/page/AudioOutputProvider.h

46 lines
1.7 KiB
C
Raw Permalink Normal View History

Add support for HTMLMediaElement.setSinkId https://bugs.webkit.org/show_bug.cgi?id=216696 Reviewed by Eric Carlson. LayoutTests/imported/w3c: * resources/import-expectations.json: * web-platform-tests/audio-output/META.yml: Added. * web-platform-tests/audio-output/idlharness.https.window-expected.txt: Added. * web-platform-tests/audio-output/idlharness.https.window.html: Added. * web-platform-tests/audio-output/idlharness.https.window.js: Added. * web-platform-tests/audio-output/setSinkId.https-expected.txt: Added. * web-platform-tests/audio-output/setSinkId.https.html: Added. * web-platform-tests/audio-output/w3c-import.log: Added. Source/WebCore: Implement setSinkId and sinkId as per https://w3c.github.io/mediacapture-output/#htmlmediaelement-extensions. Introduce a setting to expose these methods and to enable/disable user gesture requirement. Add interfaces to change device output for specific media players. Add support for HLS, MSE and MediaStreamTrack renderers on MacOS. In case of setting the empty string, the default output device is used Tests: http/wpt/audio-output/setSinkId.https.html imported/w3c/web-platform-tests/audio-output/idlharness.https.window.html imported/w3c/web-platform-tests/audio-output/setSinkId.https.html * CMakeLists.txt: * DerivedSources.make: * Modules/mediastream/MediaDevices.cpp: (WebCore::MediaDevices::exposeDevices): * Modules/mediastream/MediaDevices.h: * WebCore.xcodeproj/project.pbxproj: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::audioOutputDevice const): (WebCore::HTMLMediaElement::setAudioOutputDevice): (WebCore::HTMLMediaElement::audioOutputDeviceId const): * html/HTMLMediaElement.h: (WebCore::HTMLMediaElement::audioOutputHashedDeviceId const): * html/HTMLMediaElementAudioOutput.idl: Added. * page/Settings.yaml: * platform/graphics/MediaPlayer.cpp: (WebCore::MediaPlayer::audioOutputDeviceChanged): * platform/graphics/MediaPlayer.h: (WebCore::MediaPlayerClient::audioOutputDeviceId const): (WebCore::MediaPlayerClient::audioOutputDeviceIdOverride const): (WebCore::MediaPlayer::audioOutputDeviceId const): (WebCore::MediaPlayer::audioOutputDeviceIdOverride const): * platform/graphics/MediaPlayerPrivate.h: (WebCore::MediaPlayerPrivateInterface::audioOutputDeviceChanged): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): (WebCore::MediaPlayerPrivateAVFoundationObjC::audioOutputDeviceChanged): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::audioOutputDeviceChanged): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks): (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioOutputDeviceChanged): * platform/mediastream/AudioMediaStreamTrackRenderer.h: (WebCore::AudioMediaStreamTrackRenderer::setAudioOutputDevice): * platform/mediastream/AudioTrackPrivateMediaStream.cpp: (WebCore::AudioTrackPrivateMediaStream::setAudioOutputDevice): * platform/mediastream/AudioTrackPrivateMediaStream.h: * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.cpp: (WebCore::AudioMediaStreamTrackRendererCocoa::setAudioOutputDevice): (WebCore::AudioMediaStreamTrackRendererCocoa::pushSamples): * platform/mediastream/mac/AudioMediaStreamTrackRendererCocoa.h: * platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.cpp: (WebCore::AudioMediaStreamTrackRendererUnit::setAudioOutputDevice): (WebCore::AudioMediaStreamTrackRendererUnit::createAudioUnitIfNeeded): * platform/mediastream/mac/AudioMediaStreamTrackRendererUnit.h: Source/WebKit: Add internal flag to enable/disable user gesture requirement for setting audio output device, and for per media element setting of audio output device. * Shared/WebPreferencesExperimental.yaml: * Shared/WebPreferencesInternals.yaml: Source/WTF: Add HAVE_AUDIO_OUTPUT_DEVICE_UNIQUE_ID. * wtf/PlatformHave.h: Tools: * WebKitTestRunner/TestController.cpp: (WTR::TestController::resetPreferencesToConsistentValues): LayoutTests: Skip new tests on WK1 since mediaDevices is not implemented in WK1. * http/wpt/audio-output/setSinkId.https-expected.txt: Added. * http/wpt/audio-output/setSinkId.https.html: Added. * platform/mac-wk1/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/229664@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267472 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-23 14:04:20 +00:00
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#pragma once
namespace WebCore {
class Page;
class WEBCORE_EXPORT AudioOutputProvider {
WTF_MAKE_FAST_ALLOCATED;
public:
AudioOutputProvider() = default;
virtual ~AudioOutputProvider() = default;
virtual void defaultAudioOutputDeviceChanged(Page&);
};
inline void AudioOutputProvider::defaultAudioOutputDeviceChanged(Page&)
{
}
}