mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 943461. Part 1: A stream is fully finished when all its tracks have finished playing out. r=padenot
--HG-- extra : rebase_source : 0efa4353ea22ffd52d550331623098d275382148
This commit is contained in:
parent
3ea9bcc426
commit
77beca3623
@ -416,7 +416,10 @@ MediaStreamGraphImpl::UpdateCurrentTime()
|
||||
|
||||
for (uint32_t i = 0; i < streamsReadyToFinish.Length(); ++i) {
|
||||
MediaStream* stream = streamsReadyToFinish[i];
|
||||
if (StreamTimeToGraphTime(stream, stream->GetBufferEnd()) <= mCurrentTime) {
|
||||
// The stream is fully finished when all of its track data has been played
|
||||
// out.
|
||||
if (mCurrentTime >=
|
||||
stream->StreamTimeToGraphTime(stream->GetStreamBuffer().GetAllTracksEnd())) {
|
||||
stream->mNotifiedFinished = true;
|
||||
stream->mLastPlayedVideoFrame.SetNull();
|
||||
for (uint32_t j = 0; j < stream->mListeners.Length(); ++j) {
|
||||
|
@ -46,6 +46,25 @@ StreamBuffer::GetEnd() const
|
||||
return t;
|
||||
}
|
||||
|
||||
StreamTime
|
||||
StreamBuffer::GetAllTracksEnd() const
|
||||
{
|
||||
StreamTime t = 0;
|
||||
for (uint32_t i = 0; i < mTracks.Length(); ++i) {
|
||||
Track* track = mTracks[i];
|
||||
if (!track->IsEnded()) {
|
||||
return STREAM_TIME_MAX;
|
||||
}
|
||||
t = std::max(t, track->GetEndTimeRoundDown());
|
||||
}
|
||||
if (t > mTracksKnownTime) {
|
||||
// It can't be later then mTracksKnownTime, since a track might be added
|
||||
// after that.
|
||||
return STREAM_TIME_MAX;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
StreamBuffer::Track*
|
||||
StreamBuffer::FindTrack(TrackID aID)
|
||||
{
|
||||
|
@ -224,6 +224,13 @@ public:
|
||||
*/
|
||||
StreamTime GetEnd() const;
|
||||
|
||||
/**
|
||||
* Returns the earliest time >= 0 at which all tracks have ended
|
||||
* and all their data has been played out and no new tracks can be added,
|
||||
* or STREAM_TIME_MAX if there is no such time.
|
||||
*/
|
||||
StreamTime GetAllTracksEnd() const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void DumpTrackInfo() const;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user