Modified: trunk/Source/WebCore/ChangeLog (168098 => 168099)
--- trunk/Source/WebCore/ChangeLog 2014-05-01 15:39:17 UTC (rev 168098)
+++ trunk/Source/WebCore/ChangeLog 2014-05-01 15:43:13 UTC (rev 168099)
@@ -1,3 +1,25 @@
+2014-04-30 Jer Noble <jer.no...@apple.com>
+
+ [MSE] Seeking between two buffered ranges enquues incorrect buffers.
+ https://bugs.webkit.org/show_bug.cgi?id=132416
+
+ Reviewed by Eric Carlson.
+
+ std::equal_range(begin, end, value) will return an empty range if equal values cannot
+ be found. But the range is not necessarily [end, end). It may be some other value n,
+ such that the empty range is [n, n). Check to see if the returned range is empty in
+ findSampleContainingPresentationTime() and its reverse version, and if so, explicitly
+ return presentationEnd() or reversePresentationEnd() respectively.
+
+ Drive-by fix: make the comparator functions take const& arguments to minimize object
+ creation.
+
+ * Modules/mediasource/SampleMap.cpp:
+ (WebCore::SampleIsLessThanMediaTimeComparator::operator()):
+ (WebCore::SampleIsGreaterThanMediaTimeComparator::operator()):
+ (WebCore::SampleMap::findSampleContainingPresentationTime):
+ (WebCore::SampleMap::reverseFindSampleContainingPresentationTime):
+
2014-05-01 Zalan Bujtas <za...@apple.com>
Subpixel rendering: Inline text selection painting should not snap to integral CSS pixel position.
Modified: trunk/Source/WebCore/Modules/mediasource/SampleMap.cpp (168098 => 168099)
--- trunk/Source/WebCore/Modules/mediasource/SampleMap.cpp 2014-05-01 15:39:17 UTC (rev 168098)
+++ trunk/Source/WebCore/Modules/mediasource/SampleMap.cpp 2014-05-01 15:43:13 UTC (rev 168099)
@@ -34,12 +34,12 @@
class SampleIsLessThanMediaTimeComparator {
public:
- bool operator()(std::pair<MediaTime, RefPtr<MediaSample>> value, MediaTime time)
+ bool operator()(const SampleMap::MapType::value_type& value, const MediaTime& time)
{
MediaTime presentationEndTime = value.second->presentationTime() + value.second->duration();
return presentationEndTime <= time;
}
- bool operator()(MediaTime time, std::pair<MediaTime, RefPtr<MediaSample>> value)
+ bool operator()(const MediaTime& time, const SampleMap::MapType::value_type& value)
{
MediaTime presentationStartTime = value.second->presentationTime();
return time < presentationStartTime;
@@ -48,12 +48,12 @@
class SampleIsGreaterThanMediaTimeComparator {
public:
- bool operator()(std::pair<MediaTime, RefPtr<MediaSample>> value, MediaTime time)
+ bool operator()(const SampleMap::MapType::value_type& value, const MediaTime& time)
{
MediaTime presentationStartTime = value.second->presentationTime();
return presentationStartTime > time;
}
- bool operator()(MediaTime time, std::pair<MediaTime, RefPtr<MediaSample>> value)
+ bool operator()(const MediaTime& time, const SampleMap::MapType::value_type& value)
{
MediaTime presentationEndTime = value.second->presentationTime() + value.second->duration();
return time >= presentationEndTime;
@@ -97,7 +97,10 @@
SampleMap::iterator SampleMap::findSampleContainingPresentationTime(const MediaTime& time)
{
- return std::equal_range(presentationBegin(), presentationEnd(), time, SampleIsLessThanMediaTimeComparator()).first;
+ auto range = std::equal_range(presentationBegin(), presentationEnd(), time, SampleIsLessThanMediaTimeComparator());
+ if (range.first == range.second)
+ return presentationEnd();
+ return range.first;
}
SampleMap::iterator SampleMap::findSampleAfterPresentationTime(const MediaTime& time)
@@ -112,7 +115,10 @@
SampleMap::reverse_iterator SampleMap::reverseFindSampleContainingPresentationTime(const MediaTime& time)
{
- return std::equal_range(reversePresentationBegin(), reversePresentationEnd(), time, SampleIsGreaterThanMediaTimeComparator()).first;
+ auto range = std::equal_range(reversePresentationBegin(), reversePresentationEnd(), time, SampleIsGreaterThanMediaTimeComparator());
+ if (range.first == range.second)
+ return reversePresentationEnd();
+ return range.first;
}
SampleMap::reverse_iterator SampleMap::reverseFindSampleBeforePresentationTime(const MediaTime& time)