⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271219 in webkit


Ignore:
Timestamp:
Jan 6, 2021, 4:16:30 PM (6 years ago)
Author:
jer.noble@apple.com
Message:

[Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral"
https://bugs.webkit.org/show_bug.cgi?id=220341

Reviewed by Youenn Fablet.

Source/WebCore:

The "Spectral" pitch correction algorithm has notable deficiencies when applied to spoken
content; notably, transient propagation is missing, and the resulting audio sounds "robotic".

Revert to "TimeDomain", which is both more computationally inexpensive, and both propogates
transients and is optimized for non-harmonic content like speech.

Add a setting to allow clients to customize this behavior, e.g., if those clients would prefer
optimizing for music over speech.

Drive-by fix: re-apply the pitch algorithm after the AVPlayerItem reaches the "readyToPlay"
status to work around an AVFoundation bug.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::loadResource):

  • page/Settings.yaml:
  • page/SettingsBase.h:
  • platform/graphics/MediaPlayer.cpp:

(WebCore::MediaPlayer::setPitchCorrectionAlgorithm):

  • platform/graphics/MediaPlayer.h:
  • platform/graphics/MediaPlayerEnums.h:
  • platform/graphics/MediaPlayerPrivate.h:

(WebCore::MediaPlayerPrivateInterface::setPitchCorrectionAlgorithm):

  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
  • platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:

(WebCore::audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm):
(WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPreservesPitch):
(WebCore::MediaPlayerPrivateAVFoundationObjC::setPitchCorrectionAlgorithm):
(WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatusDidChange):

Source/WebCore/PAL:

  • pal/cocoa/AVFoundationSoftLink.h:
  • pal/cocoa/AVFoundationSoftLink.mm:

Source/WebKit:

Add a private preference to control what pitch correction algorithm will be used by MediaPlayer.

  • GPUProcess/media/RemoteMediaPlayerProxy.cpp:

(WebKit::RemoteMediaPlayerProxy::setPitchCorrectionAlgorithm):

  • GPUProcess/media/RemoteMediaPlayerProxy.h:
  • GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences _pitchCorrectionAlgorithm]):
(-[WKPreferences _setPitchCorrectionAlgorithm:]):

  • UIProcess/API/Cocoa/WKPreferencesPrivate.h:
  • WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:

(WebKit::MediaPlayerPrivateRemote::setPitchCorrectionAlgorithm):

  • WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

Source/WebKitLegacy/mac:

Add a private preference to control what pitch correction algorithm will be used by MediaPlayer.

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(-[WebPreferences _pitchCorrectionAlgorithm]):
(-[WebPreferences _setPitchCorrectionAlgorithm:]):

  • WebView/WebPreferencesPrivate.h:
  • WebView/WebView.mm:

(-[WebView _preferencesChanged:]):

Source/WTF:

Add a private preference to control what pitch correction algorithm will be used by MediaPlayer.

  • Scripts/Preferences/WebPreferences.yaml:
Location:
trunk/Source
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r271214 r271219  
     12021-01-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral"
     4        https://bugs.webkit.org/show_bug.cgi?id=220341
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Add a private preference to control what pitch correction algorithm will be used by MediaPlayer.
     9
     10        * Scripts/Preferences/WebPreferences.yaml:
     11
    1122021-01-06  Andy Estes  <aestes@apple.com>
    213
  • trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml

    r270762 r271219  
    17181718      default: true
    17191719
     1720PitchCorrectionAlgorithm:
     1721  type: uint32_t
     1722  webcoreBinding: custom
     1723  defaultValue:
     1724    WebKitLegacy:
     1725      "PLATFORM(COCOA)": static_cast<uint32_t>(WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestForSpeech)
     1726      default: static_cast<uint32_t>(WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestAllAround)
     1727    WebKit:
     1728      "PLATFORM(COCOA)": static_cast<uint32_t>(WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestForSpeech)
     1729      default: static_cast<uint32_t>(WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestAllAround)
     1730
    17201731PluginsEnabled:
    17211732  type: bool
  • trunk/Source/WebCore/ChangeLog

    r271218 r271219  
     12021-01-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral"
     4        https://bugs.webkit.org/show_bug.cgi?id=220341
     5
     6        Reviewed by Youenn Fablet.
     7
     8        The "Spectral" pitch correction algorithm has notable deficiencies when applied to spoken
     9        content; notably, transient propagation is missing, and the resulting audio sounds "robotic".
     10
     11        Revert to "TimeDomain", which is both more computationally inexpensive, and both propogates
     12        transients and is optimized for non-harmonic content like speech.
     13
     14        Add a setting to allow clients to customize this behavior, e.g., if those clients would prefer
     15        optimizing for music over speech.
     16
     17        Drive-by fix: re-apply the pitch algorithm after the AVPlayerItem reaches the "readyToPlay"
     18        status to work around an AVFoundation bug.
     19
     20        * html/HTMLMediaElement.cpp:
     21        (WebCore::HTMLMediaElement::loadResource):
     22        * page/Settings.yaml:
     23        * page/SettingsBase.h:
     24        * platform/graphics/MediaPlayer.cpp:
     25        (WebCore::MediaPlayer::setPitchCorrectionAlgorithm):
     26        * platform/graphics/MediaPlayer.h:
     27        * platform/graphics/MediaPlayerEnums.h:
     28        * platform/graphics/MediaPlayerPrivate.h:
     29        (WebCore::MediaPlayerPrivateInterface::setPitchCorrectionAlgorithm):
     30        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
     31        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
     32        (WebCore::audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm):
     33        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
     34        (WebCore::MediaPlayerPrivateAVFoundationObjC::setPreservesPitch):
     35        (WebCore::MediaPlayerPrivateAVFoundationObjC::setPitchCorrectionAlgorithm):
     36        (WebCore::MediaPlayerPrivateAVFoundationObjC::playerItemStatusDidChange):
     37
    1382021-01-06  Aditya Keerthi  <akeerthi@apple.com>
    239
  • trunk/Source/WebCore/PAL/ChangeLog

    r270872 r271219  
     12021-01-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral"
     4        https://bugs.webkit.org/show_bug.cgi?id=220341
     5
     6        Reviewed by Youenn Fablet.
     7
     8        * pal/cocoa/AVFoundationSoftLink.h:
     9        * pal/cocoa/AVFoundationSoftLink.mm:
     10
    1112020-12-15  Jer Noble  <jer.noble@apple.com>
    212
  • trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.h

    r268308 r271219  
    101101SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVAudioTimePitchAlgorithmSpectral, NSString *)
    102102#define AVAudioTimePitchAlgorithmSpectral PAL::get_AVFoundation_AVAudioTimePitchAlgorithmSpectral()
     103SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVAudioTimePitchAlgorithmTimeDomain, NSString *)
     104#define AVAudioTimePitchAlgorithmTimeDomain PAL::get_AVFoundation_AVAudioTimePitchAlgorithmTimeDomain()
    103105SOFT_LINK_CONSTANT_FOR_HEADER(PAL, AVFoundation, AVAudioTimePitchAlgorithmVarispeed, NSString *)
    104106#define AVAudioTimePitchAlgorithmVarispeed PAL::get_AVFoundation_AVAudioTimePitchAlgorithmVarispeed()
  • trunk/Source/WebCore/PAL/pal/cocoa/AVFoundationSoftLink.mm

    r268308 r271219  
    127127SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAssetImageGeneratorApertureModeCleanAperture, NSString *, PAL_EXPORT)
    128128SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioTimePitchAlgorithmSpectral, NSString *, PAL_EXPORT)
     129SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioTimePitchAlgorithmTimeDomain, NSString *, PAL_EXPORT)
    129130SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVAudioTimePitchAlgorithmVarispeed, NSString *, PAL_EXPORT)
    130131SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(PAL, AVFoundation, AVCaptureDeviceWasConnectedNotification, NSString *, PAL_EXPORT)
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r270171 r271219  
    14481448        m_player->setPreload(m_mediaSession->effectivePreloadForElement());
    14491449    m_player->setPreservesPitch(m_webkitPreservesPitch);
     1450    m_player->setPitchCorrectionAlgorithm(document().settings().pitchCorrectionAlgorithm());
    14501451
    14511452    if (!m_explicitlyMuted) {
  • trunk/Source/WebCore/page/Settings.yaml

    r270823 r271219  
    411411      default: false
    412412
     413PitchCorrectionAlgorithm:
     414  type: uint32_t
     415  refinedType: MediaPlayerEnums::PitchCorrectionAlgorithm
     416  defaultValue:
     417    WebCore:
     418      default: MediaPlayerEnums::PitchCorrectionAlgorithm::BestAllAround
     419
    413420PDFImageCachingPolicy:
    414421  type: uint32_t
  • trunk/Source/WebCore/page/SettingsBase.h

    r270557 r271219  
    3636#include "FrameFlattening.h"
    3737#include "HTMLParserScriptingFlagPolicy.h"
     38#include "MediaPlayerEnums.h"
    3839#include "PDFImageCachingPolicy.h"
    3940#include "StorageBlockingPolicy.h"
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp

    r270586 r271219  
    932932}
    933933
     934void MediaPlayer::setPitchCorrectionAlgorithm(PitchCorrectionAlgorithm pitchCorrectionAlgorithm)
     935{
     936    if (m_pitchCorrectionAlgorithm == pitchCorrectionAlgorithm)
     937        return;
     938
     939    m_pitchCorrectionAlgorithm = pitchCorrectionAlgorithm;
     940    m_private->setPitchCorrectionAlgorithm(pitchCorrectionAlgorithm);
     941}
     942
    934943std::unique_ptr<PlatformTimeRanges> MediaPlayer::buffered()
    935944{
  • trunk/Source/WebCore/platform/graphics/MediaPlayer.h

    r269850 r271219  
    399399    void setPreservesPitch(bool);
    400400
     401    void setPitchCorrectionAlgorithm(PitchCorrectionAlgorithm);
     402    PitchCorrectionAlgorithm pitchCorrectionAlgorithm() const { return m_pitchCorrectionAlgorithm; }
     403
    401404    std::unique_ptr<PlatformTimeRanges> buffered();
    402405    std::unique_ptr<PlatformTimeRanges> seekable();
     
    672675    bool m_initializingMediaEngine { false };
    673676    DynamicRangeMode m_preferredDynamicRangeMode { DynamicRangeMode::Standard };
     677    PitchCorrectionAlgorithm m_pitchCorrectionAlgorithm { PitchCorrectionAlgorithm::BestAllAround };
    674678
    675679#if ENABLE(MEDIA_SOURCE)
  • trunk/Source/WebCore/platform/graphics/MediaPlayerEnums.h

    r257711 r271219  
    107107    };
    108108
     109    enum class PitchCorrectionAlgorithm : uint8_t {
     110        BestAllAround,
     111        BestForMusic,
     112        BestForSpeech,
     113    };
    109114};
    110115
     
    241246};
    242247
     248template<> struct EnumTraits<WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm> {
     249using values = EnumValues<
     250    WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm,
     251    WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestAllAround,
     252    WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestForMusic,
     253    WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm::BestForSpeech
     254    >;
     255};
     256
    243257}; // namespace WTF
  • trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h

    r269907 r271219  
    124124
    125125    virtual void setPreservesPitch(bool) { }
     126    virtual void setPitchCorrectionAlgorithm(MediaPlayer::PitchCorrectionAlgorithm) { }
    126127
    127128    virtual bool paused() const = 0;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h

    r269850 r271219  
    199199    double rate() const final;
    200200    void setPreservesPitch(bool) final;
     201    void setPitchCorrectionAlgorithm(MediaPlayer::PitchCorrectionAlgorithm) final;
    201202    void seekToTime(const MediaTime&, const MediaTime& negativeTolerance, const MediaTime& positiveTolerance) final;
    202203    unsigned long long totalBytes() const final;
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

    r271214 r271219  
    10361036}
    10371037
     1038static NSString* audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm(MediaPlayer::PitchCorrectionAlgorithm pitchCorrectionAlgorithm, bool preservesPitch)
     1039{
     1040    if (!preservesPitch)
     1041        return AVAudioTimePitchAlgorithmVarispeed;
     1042
     1043    switch (pitchCorrectionAlgorithm) {
     1044    case MediaPlayer::PitchCorrectionAlgorithm::BestAllAround:
     1045    case MediaPlayer::PitchCorrectionAlgorithm::BestForMusic:
     1046        return AVAudioTimePitchAlgorithmSpectral;
     1047    case MediaPlayer::PitchCorrectionAlgorithm::BestForSpeech:
     1048        return AVAudioTimePitchAlgorithmTimeDomain;
     1049    }
     1050}
     1051
    10381052void MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem()
    10391053{
     
    10541068        [m_avPlayerItem.get() addObserver:m_objcObserver.get() forKeyPath:keyName options:options context:(void *)MediaPlayerAVFoundationObservationContextPlayerItem];
    10551069
    1056     [m_avPlayerItem setAudioTimePitchAlgorithm:(player()->preservesPitch() ? AVAudioTimePitchAlgorithmSpectral : AVAudioTimePitchAlgorithmVarispeed)];
     1070    [m_avPlayerItem setAudioTimePitchAlgorithm:audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm(player()->pitchCorrectionAlgorithm(), player()->preservesPitch())];
    10571071
    10581072    if (m_avPlayer)
     
    14621476{
    14631477    if (m_avPlayerItem)
    1464         [m_avPlayerItem setAudioTimePitchAlgorithm:(preservesPitch ? AVAudioTimePitchAlgorithmSpectral : AVAudioTimePitchAlgorithmVarispeed)];
     1478        [m_avPlayerItem setAudioTimePitchAlgorithm:audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm(player()->pitchCorrectionAlgorithm(), preservesPitch)];
     1479}
     1480
     1481void MediaPlayerPrivateAVFoundationObjC::setPitchCorrectionAlgorithm(MediaPlayer::PitchCorrectionAlgorithm pitchCorrectionAlgorithm)
     1482{
     1483    if (m_avPlayerItem)
     1484        [m_avPlayerItem setAudioTimePitchAlgorithm:audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm(pitchCorrectionAlgorithm, player()->preservesPitch())];
    14651485}
    14661486
     
    29482968    m_cachedItemStatus = status;
    29492969
     2970    // FIXME(rdar://72829354): Remove after AVFoundation radar is fixed.
     2971    if (status == AVPlayerItemStatusReadyToPlay)
     2972        [m_avPlayerItem setAudioTimePitchAlgorithm:audioTimePitchAlgorithmForMediaPlayerPitchCorrectionAlgorithm(player()->pitchCorrectionAlgorithm(), player()->preservesPitch())];
     2973
    29502974    updateStates();
    29512975}
  • trunk/Source/WebKit/ChangeLog

    r271217 r271219  
     12021-01-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral"
     4        https://bugs.webkit.org/show_bug.cgi?id=220341
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Add a private preference to control what pitch correction algorithm will be used by MediaPlayer.
     9
     10        * GPUProcess/media/RemoteMediaPlayerProxy.cpp:
     11        (WebKit::RemoteMediaPlayerProxy::setPitchCorrectionAlgorithm):
     12        * GPUProcess/media/RemoteMediaPlayerProxy.h:
     13        * GPUProcess/media/RemoteMediaPlayerProxy.messages.in:
     14        * UIProcess/API/Cocoa/WKPreferences.mm:
     15        (-[WKPreferences _pitchCorrectionAlgorithm]):
     16        (-[WKPreferences _setPitchCorrectionAlgorithm:]):
     17        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
     18        * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
     19        (WebKit::MediaPlayerPrivateRemote::setPitchCorrectionAlgorithm):
     20        * WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
     21        * WebProcess/WebPage/WebPage.cpp:
     22        (WebKit::WebPage::updatePreferences):
     23
    1242021-01-06  Yusuke Suzuki  <ysuzuki@apple.com>
    225
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.cpp

    r271076 r271219  
    207207}
    208208
     209void RemoteMediaPlayerProxy::setPitchCorrectionAlgorithm(WebCore::MediaPlayer::PitchCorrectionAlgorithm algorithm)
     210{
     211    m_player->setPitchCorrectionAlgorithm(algorithm);
     212}
     213
    209214void RemoteMediaPlayerProxy::prepareForRendering()
    210215{
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h

    r271076 r271219  
    134134    void setPrivateBrowsingMode(bool);
    135135    void setPreservesPitch(bool);
     136    void setPitchCorrectionAlgorithm(WebCore::MediaPlayer::PitchCorrectionAlgorithm);
    136137
    137138    void setVisible(bool);
  • trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in

    r270805 r271219  
    4747    SetPrivateBrowsingMode(bool privateMode)
    4848    SetPreservesPitch(bool preservesPitch)
     49    SetPitchCorrectionAlgorithm(WebCore::MediaPlayer::PitchCorrectionAlgorithm algorithm)
    4950
    5051    PrepareForRendering()
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

    r271032 r271219  
    14701470}
    14711471
     1472- (_WKPitchCorrectionAlgorithm)_pitchCorrectionAlgorithm
     1473{
     1474    return static_cast<_WKPitchCorrectionAlgorithm>(_preferences->pitchCorrectionAlgorithm());
     1475}
     1476
     1477- (void)_setPitchCorrectionAlgorithm:(_WKPitchCorrectionAlgorithm)pitchCorrectionAlgorithm
     1478{
     1479    _preferences->setPitchCorrectionAlgorithm(pitchCorrectionAlgorithm);
     1480}
     1481
    14721482@end
    14731483
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h

    r270710 r271219  
    5252} WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
    5353
     54typedef NS_ENUM(NSInteger, _WKPitchCorrectionAlgorithm) {
     55    _WKPitchCorrectionAlgorithmBestAllAround,
     56    _WKPitchCorrectionAlgorithmBestForMusic,
     57    _WKPitchCorrectionAlgorithmBestForSpeech,
     58} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
     59
    5460@class _WKExperimentalFeature;
    5561@class _WKInternalDebugFeature;
     
    164170@property (nonatomic, setter=_setSpeechRecognitionEnabled:) BOOL _speechRecognitionEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
    165171@property (nonatomic, setter=_setPrivateClickMeasurementEnabled:) BOOL _privateClickMeasurementEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
     172@property (nonatomic, setter=_setPitchCorrectionAlgorithm:) _WKPitchCorrectionAlgorithm _pitchCorrectionAlgorithm WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
    166173
    167174#if !TARGET_OS_IPHONE
  • trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp

    r270987 r271219  
    214214}
    215215
     216void MediaPlayerPrivateRemote::setPitchCorrectionAlgorithm(WebCore::MediaPlayer::PitchCorrectionAlgorithm algorithm)
     217{
     218    connection().send(Messages::RemoteMediaPlayerProxy::SetPitchCorrectionAlgorithm(algorithm), m_id);
     219}
     220
    216221void MediaPlayerPrivateRemote::setVolumeDouble(double volume)
    217222{
  • trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h

    r270563 r271219  
    207207    void setPrivateBrowsingMode(bool) final;
    208208    void setPreservesPitch(bool) final;
     209    void setPitchCorrectionAlgorithm(WebCore::MediaPlayer::PitchCorrectionAlgorithm) final;
    209210
    210211    bool shouldIgnoreIntrinsicSize() final;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r271214 r271219  
    37563756    settings.setDataDetectorTypes(static_cast<DataDetectorType>(store.getUInt32ValueForKey(WebPreferencesKey::dataDetectorTypesKey())));
    37573757#endif
     3758    settings.setPitchCorrectionAlgorithm(static_cast<MediaPlayerEnums::PitchCorrectionAlgorithm>(store.getUInt32ValueForKey(WebPreferencesKey::pitchCorrectionAlgorithmKey())));
    37583759
    37593760    DatabaseManager::singleton().setIsAvailable(store.getBoolValueForKey(WebPreferencesKey::databasesEnabledKey()));
  • trunk/Source/WebKitLegacy/mac/ChangeLog

    r271131 r271219  
     12021-01-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [Cocoa] Revert audioTimePitchAlgorithm to "TimeDomain" from "Spectral"
     4        https://bugs.webkit.org/show_bug.cgi?id=220341
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Add a private preference to control what pitch correction algorithm will be used by MediaPlayer.
     9
     10        * WebView/WebPreferenceKeysPrivate.h:
     11        * WebView/WebPreferences.mm:
     12        (-[WebPreferences _pitchCorrectionAlgorithm]):
     13        (-[WebPreferences _setPitchCorrectionAlgorithm:]):
     14        * WebView/WebPreferencesPrivate.h:
     15        * WebView/WebView.mm:
     16        (-[WebView _preferencesChanged:]):
     17
    1182021-01-04  Jeff Miller  <jeffm@apple.com>
    219
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h

    r269726 r271219  
    289289#define WebKitContactPickerAPIEnabledPreferenceKey @"WebKitContactPickerAPIEnabled"
    290290#define WebKitSpeechRecognitionEnabledPreferenceKey @"WebKitSpeechRecognitionEnabled"
     291#define WebKitPitchCorrectionAlgorithmPreferenceKey @"WebKitPitchCorrectionAlgorithm"
    291292
    292293// The preference keys below this point are deprecated and have no effect. They should
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm

    r269785 r271219  
    4646#import <WebCore/AudioSession.h>
    4747#import <WebCore/DeprecatedGlobalSettings.h>
     48#import <WebCore/MediaPlayerEnums.h>
    4849#import <WebCore/NetworkStorageSession.h>
    4950#import <WebCore/RuntimeApplicationChecks.h>
     
    33793380}
    33803381
     3382- (WebKitPitchCorrectionAlgorithm)_pitchCorrectionAlgorithm
     3383{
     3384    return static_cast<WebKitPitchCorrectionAlgorithm>([self _unsignedIntValueForKey:WebKitPitchCorrectionAlgorithmPreferenceKey]);
     3385}
     3386
     3387- (void)_setPitchCorrectionAlgorithm:(WebKitPitchCorrectionAlgorithm)pitchCorrectionAlgorithm
     3388{
     3389    [self _setUnsignedIntValue:pitchCorrectionAlgorithm forKey:WebKitPitchCorrectionAlgorithmPreferenceKey];
     3390}
     3391
    33813392@end
    33823393
  • trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h

    r269726 r271219  
    7373    WebKitAudioSessionCategoryAudioProcessing = 'proc',
    7474} WebKitAudioSessionCategory;
     75
     76typedef enum {
     77    WebKitPitchCorrectionAlgorithmBestAllAround = 0,
     78    WebKitPitchCorrectionAlgorithmBestForMusic,
     79    WebKitPitchCorrectionAlgorithmBestForSpeech,
     80} WebKitPitchCorrectionAlgorithm;
    7581
    7682extern NSString *WebPreferencesChangedNotification WEBKIT_DEPRECATED_MAC(10_3, 10_14);
     
    351357@property (nonatomic) BOOL contactPickerAPIEnabled;
    352358@property (nonatomic, setter=_setSpeechRecognitionEnabled:) BOOL _speechRecognitionEnabled;
     359@property (nonatomic, setter=_setPitchCorrectionAlgorithm:) WebKitPitchCorrectionAlgorithm _pitchCorrectionAlgorithm;
    353360@end
    354361
  • trunk/Source/WebKitLegacy/mac/WebView/WebView.mm

    r270932 r271219  
    29252925    settings.setTextDirectionSubmenuInclusionBehavior(core([preferences textDirectionSubmenuInclusionBehavior]));
    29262926    settings.setBackForwardCacheExpirationInterval(Seconds { [preferences _backForwardCacheExpirationInterval] });
     2927    settings.setPitchCorrectionAlgorithm(static_cast<WebCore::MediaPlayerEnums::PitchCorrectionAlgorithm>([preferences _pitchCorrectionAlgorithm]));
    29272928
    29282929    BOOL mediaPlaybackRequiresUserGesture = [preferences mediaPlaybackRequiresUserGesture];
Note: See TracChangeset for help on using the changeset viewer.