mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1163223 - Move bailout case in GetBuffered into the readers. r=jww
The problem here is that, because we run mReader->SetStartTime() as a promise callback, MDSM::HasStartTime() may be true while the reader hasn't been notified yet. This is obviously broken, but no more broken than the fact that GetBuffered operates synchronously (and is basically the last piece of machinery left doing so). Fixing that is next on my list, but let's just hack around this for now to get this stack landed.
This commit is contained in:
parent
2942db2631
commit
ed1ce0d8bb
@ -154,6 +154,7 @@ MediaDecoderReader::SetStartTime(int64_t aStartTime)
|
||||
media::TimeIntervals
|
||||
MediaDecoderReader::GetBuffered()
|
||||
{
|
||||
NS_ENSURE_TRUE(mStartTime >= 0, media::TimeIntervals());
|
||||
AutoPinned<MediaResource> stream(mDecoder->GetResource());
|
||||
int64_t durationUs = 0;
|
||||
{
|
||||
|
@ -266,14 +266,7 @@ public:
|
||||
}
|
||||
|
||||
media::TimeIntervals GetBuffered() {
|
||||
// It's possible for JS to query .buffered before we've determined the start
|
||||
// time from metadata, in which case the reader isn't ready to be asked this
|
||||
// question.
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
if (mStartTime < 0) {
|
||||
return media::TimeIntervals();
|
||||
}
|
||||
|
||||
return mReader->GetBuffered();
|
||||
}
|
||||
|
||||
|
@ -1300,7 +1300,7 @@ MediaFormatReader::GetBuffered()
|
||||
int64_t startTime;
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
MOZ_ASSERT(mStartTime != -1, "Need to finish metadata decode first");
|
||||
NS_ENSURE_TRUE(mStartTime >= 0, media::TimeIntervals());
|
||||
startTime = mStartTime;
|
||||
}
|
||||
if (NS_IsMainThread()) {
|
||||
|
@ -1081,7 +1081,7 @@ MP4Reader::GetBuffered()
|
||||
return buffered;
|
||||
}
|
||||
UpdateIndex();
|
||||
MOZ_ASSERT(mStartTime != -1, "Need to finish metadata decode first");
|
||||
NS_ENSURE_TRUE(mStartTime >= 0, media::TimeIntervals());
|
||||
|
||||
AutoPinned<MediaResource> resource(mDecoder->GetResource());
|
||||
nsTArray<MediaByteRange> ranges;
|
||||
|
@ -1852,7 +1852,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget,
|
||||
|
||||
media::TimeIntervals OggReader::GetBuffered()
|
||||
{
|
||||
MOZ_ASSERT(mStartTime != -1, "Need to finish metadata decode first");
|
||||
NS_ENSURE_TRUE(mStartTime >= 0, media::TimeIntervals());
|
||||
{
|
||||
mozilla::ReentrantMonitorAutoEnter mon(mMonitor);
|
||||
if (mIsChained) {
|
||||
|
@ -1093,7 +1093,7 @@ nsresult WebMReader::SeekInternal(int64_t aTarget)
|
||||
|
||||
media::TimeIntervals WebMReader::GetBuffered()
|
||||
{
|
||||
MOZ_ASSERT(mStartTime != -1, "Need to finish metadata decode first");
|
||||
NS_ENSURE_TRUE(mStartTime >= 0, media::TimeIntervals());
|
||||
AutoPinned<MediaResource> resource(mDecoder->GetResource());
|
||||
|
||||
media::TimeIntervals buffered;
|
||||
|
Loading…
Reference in New Issue
Block a user