Title: [213931] trunk/Source/WebCore
- Revision
- 213931
- Author
- jer.no...@apple.com
- Date
- 2017-03-14 12:57:11 -0700 (Tue, 14 Mar 2017)
Log Message
Pulling more frames from AudioSampleDataSource than the last push added will always fail.
https://bugs.webkit.org/show_bug.cgi?id=168644
Reviewed by Eric Carlson.
Rather than use the delta between the ring buffer's end time and the last pushed timestamp
(or what is effectively the number of samples in the last push operation) to determine if
there is enough buffered data to satisfy a pull operation, use the ring buffer's actual
buffered duration.
Then, instead of saving the last pushed timestamp, explicitly save the last push count, and
use that data to inform how much to offset the output timestamps (or what is effectively how
much to allow the source to pre-buffer).
* platform/audio/mac/AudioSampleDataSource.cpp:
(WebCore::AudioSampleDataSource::pushSamplesInternal):
(WebCore::AudioSampleDataSource::pullSamplesInternal):
* platform/audio/mac/AudioSampleDataSource.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (213930 => 213931)
--- trunk/Source/WebCore/ChangeLog 2017-03-14 19:29:26 UTC (rev 213930)
+++ trunk/Source/WebCore/ChangeLog 2017-03-14 19:57:11 UTC (rev 213931)
@@ -1,3 +1,24 @@
+2017-03-14 Jer Noble <jer.no...@apple.com>
+
+ Pulling more frames from AudioSampleDataSource than the last push added will always fail.
+ https://bugs.webkit.org/show_bug.cgi?id=168644
+
+ Reviewed by Eric Carlson.
+
+ Rather than use the delta between the ring buffer's end time and the last pushed timestamp
+ (or what is effectively the number of samples in the last push operation) to determine if
+ there is enough buffered data to satisfy a pull operation, use the ring buffer's actual
+ buffered duration.
+
+ Then, instead of saving the last pushed timestamp, explicitly save the last push count, and
+ use that data to inform how much to offset the output timestamps (or what is effectively how
+ much to allow the source to pre-buffer).
+
+ * platform/audio/mac/AudioSampleDataSource.cpp:
+ (WebCore::AudioSampleDataSource::pushSamplesInternal):
+ (WebCore::AudioSampleDataSource::pullSamplesInternal):
+ * platform/audio/mac/AudioSampleDataSource.h:
+
2017-03-14 Megan Gardner <megan_gard...@apple.com>
Correctly export WebItemProviderPasteboard
Modified: trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h (213930 => 213931)
--- trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h 2017-03-14 19:29:26 UTC (rev 213930)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.h 2017-03-14 19:57:11 UTC (rev 213931)
@@ -81,7 +81,6 @@
MediaTime hostTime() const;
- uint64_t m_timeStamp { 0 };
uint64_t m_lastPushedSampleCount { 0 };
MediaTime m_expectedNextPushedSampleTime { MediaTime::invalidTime() };
double m_hostTime { -1 };
Modified: trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm (213930 => 213931)
--- trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm 2017-03-14 19:29:26 UTC (rev 213930)
+++ trunk/Source/WebCore/platform/audio/mac/AudioSampleDataSource.mm 2017-03-14 19:57:11 UTC (rev 213931)
@@ -173,9 +173,8 @@
#endif
m_ringBuffer->store(sampleBufferList, sampleCount, sampleTime.timeValue());
- m_timeStamp = sampleTime.timeValue();
+ m_lastPushedSampleCount = sampleCount;
-
#if !LOG_DISABLED
uint64_t startFrame2 = 0;
uint64_t endFrame2 = 0;
@@ -224,7 +223,7 @@
m_ringBuffer->getCurrentFrameBounds(startFrame, endFrame);
if (m_transitioningFromPaused) {
- uint64_t buffered = endFrame - m_timeStamp;
+ uint64_t buffered = endFrame - startFrame;
if (buffered < sampleCount * 2) {
AudioSampleBufferList::zeroABL(buffer, byteCount);
sampleCount = 0;
@@ -235,12 +234,12 @@
const double tenMS = .01;
const double fiveMS = .005;
double sampleRate = m_outputDescription->sampleRate();
- m_outputSampleOffset = timeStamp + m_timeStamp;
- if (buffered > sampleRate * twentyMS)
+ m_outputSampleOffset = timeStamp + (endFrame - sampleCount);
+ if (m_lastPushedSampleCount > sampleRate * twentyMS)
m_outputSampleOffset -= sampleRate * twentyMS;
- else if (buffered > sampleRate * tenMS)
+ else if (m_lastPushedSampleCount > sampleRate * tenMS)
m_outputSampleOffset -= sampleRate * tenMS;
- else if (buffered > sampleRate * fiveMS)
+ else if (m_lastPushedSampleCount > sampleRate * fiveMS)
m_outputSampleOffset -= sampleRate * fiveMS;
m_transitioningFromPaused = false;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes