зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1423241 - Return appended StreamTime samples appended through AppendToTrack. r=padenot
This allows DecodedStream to accurately track how many samples have been appended to a track, even with resampling enabled. Differential Revision: https://phabricator.services.mozilla.com/D12272 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
80cde33d12
Коммит
e80887ac8d
|
@ -2863,11 +2863,11 @@ void SourceMediaStream::AdvanceTimeVaryingValuesToCurrentTime(
|
|||
mTracks.ForgetUpTo(aCurrentTime - mTracksStartTime);
|
||||
}
|
||||
|
||||
bool SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment,
|
||||
MediaSegment* aRawSegment) {
|
||||
StreamTime SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment,
|
||||
MediaSegment* aRawSegment) {
|
||||
MutexAutoLock lock(mMutex);
|
||||
// ::EndAllTrackAndFinished() can end these before the sources notice
|
||||
bool appended = false;
|
||||
StreamTime appended = 0;
|
||||
auto graph = GraphImpl();
|
||||
if (!mFinished && graph) {
|
||||
TrackData* track = FindDataForTrack(aID);
|
||||
|
@ -2886,8 +2886,8 @@ bool SourceMediaStream::AppendToTrack(TrackID aID, MediaSegment* aSegment,
|
|||
|
||||
// Must notify first, since AppendFrom() will empty out aSegment
|
||||
NotifyDirectConsumers(track, aRawSegment ? aRawSegment : aSegment);
|
||||
appended = aSegment->GetDuration();
|
||||
track->mData->AppendFrom(aSegment); // note: aSegment is now dead
|
||||
appended = true;
|
||||
GraphImpl()->EnsureNextIteration();
|
||||
} else {
|
||||
aSegment->Clear();
|
||||
|
|
|
@ -743,11 +743,12 @@ class SourceMediaStream : public MediaStream {
|
|||
|
||||
/**
|
||||
* Append media data to a track. Ownership of aSegment remains with the
|
||||
* caller, but aSegment is emptied. Returns false if the data was not appended
|
||||
* because no such track exists or the stream was already finished.
|
||||
* caller, but aSegment is emptied. Returns 0 if the data was not appended
|
||||
* because no such track exists or the stream was already finished. Returns
|
||||
* the duration of the appended data in the graph's track rate otherwise.
|
||||
*/
|
||||
virtual bool AppendToTrack(TrackID aID, MediaSegment* aSegment,
|
||||
MediaSegment* aRawSegment = nullptr);
|
||||
virtual StreamTime AppendToTrack(TrackID aID, MediaSegment* aSegment,
|
||||
MediaSegment* aRawSegment = nullptr);
|
||||
/**
|
||||
* Get the stream time of the end of the data that has been appended so far.
|
||||
* Can be called from any thread but won't be useful if it can race with
|
||||
|
|
|
@ -52,9 +52,9 @@ public:
|
|||
mMainThreadDestroyed = true;
|
||||
}
|
||||
|
||||
virtual bool AppendToTrack(TrackID aID, MediaSegment* aSegment, MediaSegment *aRawSegment = nullptr) override
|
||||
virtual StreamTime AppendToTrack(TrackID aID, MediaSegment* aSegment, MediaSegment *aRawSegment = nullptr) override
|
||||
{
|
||||
return true;
|
||||
return aSegment->GetDuration();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче