[webkit-changes] [WebKit/WebKit] f55c46: CAAudioStreamDescription::format() is hard to unde...

Kimmo Kinnunen noreply at github.com
Wed Nov 9 00:41:02 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f55c4602a771e8ca0900054cdc05fe2b60a94f1c
      https://github.com/WebKit/WebKit/commit/f55c4602a771e8ca0900054cdc05fe2b60a94f1c
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2022-11-09 (Wed, 09 Nov 2022)

  Changed paths:
    M Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebCore/cocoa/AudioStreamDescriptionCocoa.mm

  Log Message:
  -----------
  CAAudioStreamDescription::format() is hard to understand
https://bugs.webkit.org/show_bug.cgi?id=247605
rdar://problem/102080347

Reviewed by Eric Carlson.

An attempt to make the function more understandable:
 - Have only one success exit
 - Use "bits / 8" to compute "bytes" instead of surprising "bits / sizeof(double)"
 - Compute bytesPerSample as "bitsPerSample / 8" instead of "bytesPerFrame / ... "
   Validate bytesPerFrame based on bytesPerSample.

Add rudimentary tests exercising the function.

No change in functionality.

* Source/WebCore/platform/audio/cocoa/CAAudioStreamDescription.cpp:
(WebCore::CAAudioStreamDescription::format const):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/AudioStreamDescriptionCocoa.mm: Added.
(TYPED_TEST_P):

Canonical link: https://commits.webkit.org/256480@main




More information about the webkit-changes mailing list