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

Changeset 199067 in webkit


Ignore:
Timestamp:
Apr 5, 2016, 12:38:49 PM (11 years ago)
Author:
matthew_hanson@apple.com
Message:

Merge r199042. rdar://problem/25533763

Location:
branches/safari-601.1.46-branch/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-601.1.46-branch/Source/WebCore/ChangeLog

    r199066 r199067  
     12016-04-05  Matthew Hanson  <matthew_hanson@apple.com>
     2
     3        Merge r199042. rdar://problem/25533763
     4
     5    2016-04-04  Jer Noble  <jer.noble@apple.com>
     6
     7            [iOS] Crash when playing <video> after playing Web Audio
     8            https://bugs.webkit.org/show_bug.cgi?id=156185
     9            <rdar://problem/10177005>
     10
     11            Reviewed by Eric Carlson.
     12
     13            Off-by-one error in AudioDestinationIOS::render. The ivars m_firstSpareFrame and m_lastSpareFrame imply that
     14            the sample range is inclusive, i.e. [m_firstSpareFrame .. m_lastSpareFrame], but the length of the range was
     15            being calculated as if m_lastSpareFrame was exclusive; when the two were equal, the length was calculated as
     16            0, rather than 1. This was caught by an ASSERT (and would have been caught by a downstream ASSERT had that one
     17            not been present).
     18
     19            Fix the off-by-one by treating them as inclusive/exclusive--similar to C++ iterators--and renaming them to reflect
     20            this: [m_startSpareFrame .. m_endSpareFrame). This corrects the "length" math which caused the crash.
     21
     22            * platform/audio/ios/AudioDestinationIOS.cpp:
     23            (WebCore::AudioDestinationIOS::render):
     24            * platform/audio/ios/AudioDestinationIOS.h:
     25
    1262016-04-05  Matthew Hanson  <matthew_hanson@apple.com>
    227
  • branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.cpp

    r199066 r199067  
    218218    UInt32 frameOffset = 0;
    219219    while (framesRemaining > 0) {
    220         if (m_firstSpareFrame && m_lastSpareFrame) {
    221             ASSERT(m_firstSpareFrame < m_lastSpareFrame);
    222             UInt32 framesThisTime = m_lastSpareFrame - m_firstSpareFrame;
     220        if (m_startSpareFrame && m_endSpareFrame) {
     221            ASSERT(m_startSpareFrame < m_endSpareFrame);
     222            UInt32 framesThisTime = m_endSpareFrame - m_startSpareFrame;
    223223            assignAudioBuffersToBus(buffers, *m_renderBus, numberOfBuffers, numberOfFrames, frameOffset, framesThisTime);
    224             m_renderBus->copyFromRange(*m_spareBus, m_firstSpareFrame, m_lastSpareFrame);
     224            m_renderBus->copyFromRange(*m_spareBus, m_startSpareFrame, m_endSpareFrame);
    225225            frameOffset += framesThisTime;
    226226            framesRemaining -= framesThisTime;
    227             m_firstSpareFrame = 0;
    228             m_lastSpareFrame = 0;
     227            m_startSpareFrame = 0;
     228            m_endSpareFrame = 0;
    229229        }
    230230
    … …  
    235235            m_callback.render(0, m_spareBus.get(), kRenderBufferSize);
    236236            m_renderBus->copyFromRange(*m_spareBus, 0, framesThisTime);
    237             m_firstSpareFrame = framesThisTime;
    238             m_lastSpareFrame = kRenderBufferSize - 1;
     237            m_startSpareFrame = framesThisTime;
     238            m_endSpareFrame = kRenderBufferSize;
    239239        } else
    240240            m_callback.render(0, m_renderBus.get(), framesThisTime);
  • branches/safari-601.1.46-branch/Source/WebCore/platform/audio/ios/AudioDestinationIOS.h

    r199066 r199067  
    6767    RefPtr<AudioBus> m_renderBus;
    6868    RefPtr<AudioBus> m_spareBus;
    69     unsigned m_firstSpareFrame { 0 };
    70     unsigned m_lastSpareFrame { 0 };
     69    unsigned m_startSpareFrame { 0 };
     70    unsigned m_endSpareFrame { 0 };
    7171
    7272    double m_sampleRate;
Note: See TracChangeset for help on using the changeset viewer.