<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[211437] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/211437">211437</a></dd>
<dt>Author</dt> <dd>eric.carlson@apple.com</dd>
<dt>Date</dt> <dd>2017-01-31 10:18:44 -0800 (Tue, 31 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] Add an audio stream description class
https://bugs.webkit.org/show_bug.cgi?id=167639

Reviewed by Youenn Fablet.

No new tests, the new class is not used yet.

* WebCore.xcodeproj/project.pbxproj:
* platform/audio/AudioStreamDescription.h: Added.
(WebCore::AudioStreamDescription::isPCM):
* platform/audio/mac/CAAudioStreamDescription.cpp: Added.
(WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
(WebCore::CAAudioStreamDescription::platformDescription):
(WebCore::CAAudioStreamDescription::format):
(WebCore::toCAAudioStreamDescription):
(WebCore::CAAudioStreamDescription::operator==):
(WebCore::operator==):
* platform/audio/mac/CAAudioStreamDescription.h: Added.
(WebCore::operator!=):
(WebCore::CAAudioStreamDescription::bytesPerFrame):
(WebCore::CAAudioStreamDescription::bytesPerPacket):
(WebCore::CAAudioStreamDescription::formatFlags):
(WebCore::CAAudioStreamDescription::operator==):
(WebCore::CAAudioStreamDescription::operator!=):
(WebCore::CAAudioStreamDescription::streamDescription):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformaudioAudioStreamDescriptionh">trunk/Source/WebCore/platform/audio/AudioStreamDescription.h</a></li>
<li><a href="#trunkSourceWebCoreplatformaudiomacCAAudioStreamDescriptioncpp">trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformaudiomacCAAudioStreamDescriptionh">trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211436 => 211437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-31 17:52:33 UTC (rev 211436)
+++ trunk/Source/WebCore/ChangeLog        2017-01-31 18:18:44 UTC (rev 211437)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2017-01-31  Eric Carlson  &lt;eric.carlson@apple.com&gt;
+
+        [Mac] Add an audio stream description class
+        https://bugs.webkit.org/show_bug.cgi?id=167639
+
+        Reviewed by Youenn Fablet.
+
+        No new tests, the new class is not used yet.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/audio/AudioStreamDescription.h: Added.
+        (WebCore::AudioStreamDescription::isPCM):
+        * platform/audio/mac/CAAudioStreamDescription.cpp: Added.
+        (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
+        (WebCore::CAAudioStreamDescription::platformDescription):
+        (WebCore::CAAudioStreamDescription::format):
+        (WebCore::toCAAudioStreamDescription):
+        (WebCore::CAAudioStreamDescription::operator==):
+        (WebCore::operator==):
+        * platform/audio/mac/CAAudioStreamDescription.h: Added.
+        (WebCore::operator!=):
+        (WebCore::CAAudioStreamDescription::bytesPerFrame):
+        (WebCore::CAAudioStreamDescription::bytesPerPacket):
+        (WebCore::CAAudioStreamDescription::formatFlags):
+        (WebCore::CAAudioStreamDescription::operator==):
+        (WebCore::CAAudioStreamDescription::operator!=):
+        (WebCore::CAAudioStreamDescription::streamDescription):
+
</ins><span class="cx"> 2017-01-31  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         RTCPeerConnection methods can take dictionaries as input
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (211436 => 211437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-31 17:52:33 UTC (rev 211436)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-01-31 18:18:44 UTC (rev 211437)
</span><span class="lines">@@ -7218,6 +7218,9 @@
</span><span class="cx">                 073794F819F5864E00E5A045 /* RTCNotifiersMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RTCNotifiersMock.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 07394EC71BAB2CCD00BE99CD /* MediaDevicesRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaDevicesRequest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 07394EC91BAB2CD700BE99CD /* MediaDevicesRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaDevicesRequest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                073B87561E40DCE50071C0EC /* AudioStreamDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioStreamDescription.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                073B87571E40DCFD0071C0EC /* CAAudioStreamDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CAAudioStreamDescription.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                073B87581E40DCFD0071C0EC /* CAAudioStreamDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CAAudioStreamDescription.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 073BE33E17D17E01002BD431 /* JSNavigatorUserMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNavigatorUserMedia.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 073BE33F17D17E01002BD431 /* JSNavigatorUserMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNavigatorUserMedia.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0744ECEB1E0C4AE5000D0944 /* MockRealtimeAudioSourceMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockRealtimeAudioSourceMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -24784,6 +24787,7 @@
</span><span class="cx">                 FD31604012B026A300C1A359 /* audio */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                073B87561E40DCE50071C0EC /* AudioStreamDescription.h */,
</ins><span class="cx">                                 CD669D651D232DF4004D1866 /* cocoa */,
</span><span class="cx">                                 CD0EEE0D14743E48003EAFA2 /* ios */,
</span><span class="cx">                                 FD3160B012B0270700C1A359 /* mac */,
</span><span class="lines">@@ -24876,6 +24880,8 @@
</span><span class="cx">                 FD3160B012B0270700C1A359 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                073B87571E40DCFD0071C0EC /* CAAudioStreamDescription.cpp */,
+                                073B87581E40DCFD0071C0EC /* CAAudioStreamDescription.h */,
</ins><span class="cx">                                 FD3160B512B0272A00C1A359 /* AudioBusMac.mm */,
</span><span class="cx">                                 FD3160B612B0272A00C1A359 /* AudioDestinationMac.cpp */,
</span><span class="cx">                                 FD3160B712B0272A00C1A359 /* AudioDestinationMac.h */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformaudioAudioStreamDescriptionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/audio/AudioStreamDescription.h (0 => 211437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/AudioStreamDescription.h                                (rev 0)
+++ trunk/Source/WebCore/platform/audio/AudioStreamDescription.h        2017-01-31 18:18:44 UTC (rev 211437)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+/*
+ * Copyright (C) 2017 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
+
+#include &lt;wtf/Variant.h&gt;
+
+typedef struct AudioStreamBasicDescription AudioStreamBasicDescription;
+
+namespace WebCore {
+
+struct PlatformDescription {
+    enum {
+        None,
+        CAAudioStreamBasicType,
+    } type;
+    Variant&lt;std::nullptr_t, const AudioStreamBasicDescription*&gt; description;
+};
+
+class AudioStreamDescription {
+public:
+    virtual ~AudioStreamDescription() = default;
+
+    virtual const PlatformDescription&amp; platformDescription() const = 0;
+
+    enum PCMFormat {
+        None,
+        Int16,
+        Float32,
+        Float64
+    };
+    virtual PCMFormat format() const = 0;
+
+    virtual double sampleRate() const = 0;
+
+    virtual bool isPCM() const { return format() != None; }
+    virtual bool isInterleaved() const = 0;
+    virtual bool isSignedInteger() const = 0;
+    virtual bool isFloat() const = 0;
+    virtual bool isNativeEndian() const = 0;
+
+    virtual uint32_t numberOfInterleavedChannels() const = 0;
+    virtual uint32_t numberOfChannelStreams() const = 0;
+    virtual uint32_t numberOfChannels() const = 0;
+    virtual uint32_t sampleWordSize() const = 0;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudiomacCAAudioStreamDescriptioncpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp (0 => 211437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp                                (rev 0)
+++ trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.cpp        2017-01-31 18:18:44 UTC (rev 211437)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+/*
+ * Copyright (C) 2017 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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CAAudioStreamDescription.h&quot;
+
+namespace WebCore {
+
+CAAudioStreamDescription::CAAudioStreamDescription(const AudioStreamBasicDescription &amp;desc)
+    : m_streamDescription(desc)
+{
+}
+
+CAAudioStreamDescription::CAAudioStreamDescription(double sampleRate, UInt32 numChannels, PCMFormat format, bool isInterleaved)
+{
+    m_streamDescription.mFormatID = kAudioFormatLinearPCM;
+    m_streamDescription.mSampleRate = sampleRate;
+    m_streamDescription.mFramesPerPacket = 1;
+    m_streamDescription.mChannelsPerFrame = numChannels;
+    m_streamDescription.mBytesPerFrame = 0;
+    m_streamDescription.mBytesPerPacket = 0;
+    m_streamDescription.mFormatFlags = kAudioFormatFlagsNativeEndian | kAudioFormatFlagIsPacked;
+    m_streamDescription.mReserved = 0;
+
+    int wordsize;
+    switch (format) {
+    case Float32:
+        wordsize = 4;
+        m_streamDescription.mFormatFlags |= kAudioFormatFlagIsFloat;
+        break;
+    case Float64:
+        wordsize = 8;
+        m_streamDescription.mFormatFlags |= kAudioFormatFlagIsFloat;
+        break;
+    case Int16:
+        wordsize = 2;
+        m_streamDescription.mFormatFlags |= kAudioFormatFlagIsSignedInteger;
+        break;
+    case None:
+        ASSERT_NOT_REACHED();
+    }
+
+    m_streamDescription.mBitsPerChannel = wordsize * 8;
+    if (isInterleaved)
+        m_streamDescription.mBytesPerFrame = m_streamDescription.mBytesPerPacket = wordsize * numChannels;
+    else {
+        m_streamDescription.mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
+        m_streamDescription.mBytesPerFrame = m_streamDescription.mBytesPerPacket = wordsize;
+    }
+}
+
+const PlatformDescription&amp; CAAudioStreamDescription::platformDescription() const
+{
+    m_platformDescription = { PlatformDescription::CAAudioStreamBasicType, &amp;m_streamDescription };
+    return m_platformDescription;
+}
+
+AudioStreamDescription::PCMFormat CAAudioStreamDescription::format() const
+{
+    if (m_format != None)
+        return m_format;
+
+    if (m_streamDescription.mFormatID != kAudioFormatLinearPCM)
+        return None;
+    if (m_streamDescription.mFramesPerPacket != 1)
+        return None;
+    if (m_streamDescription.mBytesPerFrame != m_streamDescription.mBytesPerPacket)
+        return None;
+    if (m_streamDescription.mBitsPerChannel / sizeof(double) &gt; m_streamDescription.mBytesPerFrame)
+        return None;
+    if (!m_streamDescription.mChannelsPerFrame)
+        return None;
+
+    unsigned wordsize = m_streamDescription.mBytesPerFrame;
+    if (isInterleaved()) {
+        if (wordsize % m_streamDescription.mChannelsPerFrame)
+            return None;
+
+        wordsize /= m_streamDescription.mChannelsPerFrame;
+    }
+
+    if (isNativeEndian() &amp;&amp; wordsize * sizeof(double) == m_streamDescription.mBitsPerChannel) {
+        // Packed and native endian, good
+        if (m_streamDescription.mFormatFlags &amp; kLinearPCMFormatFlagIsFloat) {
+            if (m_streamDescription.mFormatFlags &amp; (kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagsSampleFractionMask))
+                return None;
+
+            if (wordsize == sizeof(float))
+                return m_format = Float32;
+            else if (wordsize == sizeof(double))
+                return m_format = Float64;
+
+            return None;
+        }
+
+        if (m_streamDescription.mFormatFlags &amp; kLinearPCMFormatFlagIsSignedInteger) {
+            unsigned fractionBits = (m_streamDescription.mFormatFlags &amp; kLinearPCMFormatFlagsSampleFractionMask) &gt;&gt; kLinearPCMFormatFlagsSampleFractionShift;
+            if (wordsize == 2 &amp;&amp; !fractionBits)
+                return m_format = Int16;
+        }
+    }
+
+    return None;
+}
+
+bool CAAudioStreamDescription::operator==(const AudioStreamDescription&amp; other)
+{
+    if (other.platformDescription().type != PlatformDescription::CAAudioStreamBasicType)
+        return false;
+
+    return operator==(*WTF::get&lt;const AudioStreamBasicDescription*&gt;(other.platformDescription().description));
+}
+
+bool operator==(const AudioStreamBasicDescription&amp; a, const AudioStreamBasicDescription&amp; b)
+{
+    return a.mSampleRate == b.mSampleRate
+        &amp;&amp; a.mFormatID == b.mFormatID
+        &amp;&amp; a.mFormatFlags == b.mFormatFlags
+        &amp;&amp; a.mBytesPerPacket == b.mBytesPerPacket
+        &amp;&amp; a.mFramesPerPacket == b.mFramesPerPacket
+        &amp;&amp; a.mBytesPerFrame == b.mBytesPerFrame
+        &amp;&amp; a.mChannelsPerFrame == b.mChannelsPerFrame
+        &amp;&amp; a.mBitsPerChannel == b.mBitsPerChannel;
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformaudiomacCAAudioStreamDescriptionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h (0 => 211437)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h                                (rev 0)
+++ trunk/Source/WebCore/platform/audio/mac/CAAudioStreamDescription.h        2017-01-31 18:18:44 UTC (rev 211437)
</span><span class="lines">@@ -0,0 +1,83 @@
</span><ins>+/*
+ * Copyright (C) 2017 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
+
+#include &quot;AudioStreamDescription.h&quot;
+#include &lt;CoreAudio/CoreAudioTypes.h&gt;
+
+namespace WebCore {
+
+bool operator==(const AudioStreamBasicDescription&amp;, const AudioStreamBasicDescription&amp;);
+inline bool operator!=(const AudioStreamBasicDescription&amp; a, const AudioStreamBasicDescription&amp; b) { return !(a == b); }
+
+class CAAudioStreamDescription final : public AudioStreamDescription {
+public:
+    CAAudioStreamDescription(const AudioStreamBasicDescription&amp;);
+    CAAudioStreamDescription(double, uint32_t, PCMFormat, bool);
+
+    const PlatformDescription&amp; platformDescription() const final;
+
+    PCMFormat format() const final;
+
+    double sampleRate() const final { return m_streamDescription.mSampleRate; }
+
+    bool isInterleaved() const final { return !(m_streamDescription.mFormatFlags &amp; kAudioFormatFlagIsNonInterleaved); }
+    bool isSignedInteger() const final { return isPCM() &amp;&amp; (m_streamDescription.mFormatFlags &amp; kAudioFormatFlagIsSignedInteger); }
+    bool isFloat() const final { return isPCM() &amp;&amp; (m_streamDescription.mFormatFlags &amp; kAudioFormatFlagIsFloat); }
+    bool isNativeEndian() const final { return isPCM() &amp;&amp; (m_streamDescription.mFormatFlags &amp; kAudioFormatFlagIsBigEndian) == kAudioFormatFlagsNativeEndian; }
+
+    uint32_t numberOfInterleavedChannels() const final { return isInterleaved() ? m_streamDescription.mChannelsPerFrame : 1; }
+    uint32_t numberOfChannelStreams() const final { return isInterleaved() ? 1 : m_streamDescription.mChannelsPerFrame; }
+    uint32_t numberOfChannels() const final { return m_streamDescription.mChannelsPerFrame; }
+    uint32_t sampleWordSize() const final {
+        return (m_streamDescription.mBytesPerFrame &gt; 0 &amp;&amp; numberOfInterleavedChannels()) ? m_streamDescription.mBytesPerFrame / numberOfInterleavedChannels() :  0;
+    }
+    uint32_t bytesPerFrame() const { return m_streamDescription.mBytesPerFrame; }
+    uint32_t bytesPerPacket() const { return m_streamDescription.mBytesPerPacket; }
+    uint32_t formatFlags() const { return m_streamDescription.mFormatFlags; }
+
+    bool operator==(const AudioStreamBasicDescription&amp; other) { return m_streamDescription == other; }
+    bool operator!=(const AudioStreamBasicDescription&amp; other) { return !operator == (other); }
+    bool operator==(const AudioStreamDescription&amp;);
+    bool operator!=(const AudioStreamDescription&amp; other) { return !operator == (other); }
+
+    const AudioStreamBasicDescription&amp; streamDescription() { return m_streamDescription; }
+
+private:
+    void calculateFormat();
+
+    AudioStreamBasicDescription m_streamDescription;
+    mutable PlatformDescription m_platformDescription;
+    mutable PCMFormat m_format { None };
+};
+
+inline CAAudioStreamDescription toCAAudioStreamDescription(const AudioStreamDescription&amp; description)
+{
+    ASSERT(description.platformDescription().type == PlatformDescription::CAAudioStreamBasicType);
+    return CAAudioStreamDescription(*WTF::get&lt;const AudioStreamBasicDescription*&gt;(description.platformDescription().description));
+}
+
+}
</ins></span></pre>
</div>
</div>

</body>
</html>