зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1171314: P2. Fill SharedTrackInfo data in MSE samples. r=cpearce
This commit is contained in:
Родитель
16649c81d5
Коммит
91e1665b64
|
@ -37,6 +37,8 @@ AppendStateToStr(TrackBuffersManager::AppendState aState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Atomic<uint32_t> sStreamSourceID(0u);
|
||||||
|
|
||||||
TrackBuffersManager::TrackBuffersManager(dom::SourceBuffer* aParent, MediaSourceDecoder* aParentDecoder, const nsACString& aType)
|
TrackBuffersManager::TrackBuffersManager(dom::SourceBuffer* aParent, MediaSourceDecoder* aParentDecoder, const nsACString& aType)
|
||||||
: mInputBuffer(new MediaByteBuffer)
|
: mInputBuffer(new MediaByteBuffer)
|
||||||
, mAppendState(AppendState::WAITING_FOR_SEGMENT)
|
, mAppendState(AppendState::WAITING_FOR_SEGMENT)
|
||||||
|
@ -794,6 +796,9 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
|
||||||
// 4. Let active track flag equal false.
|
// 4. Let active track flag equal false.
|
||||||
mActiveTrack = false;
|
mActiveTrack = false;
|
||||||
|
|
||||||
|
// Increase our stream id.
|
||||||
|
uint32_t streamID = sStreamSourceID++;
|
||||||
|
|
||||||
// 5. If the first initialization segment received flag is false, then run the following steps:
|
// 5. If the first initialization segment received flag is false, then run the following steps:
|
||||||
if (!mFirstInitializationSegmentReceived) {
|
if (!mFirstInitializationSegmentReceived) {
|
||||||
mAudioTracks.mNumTracks = numAudios;
|
mAudioTracks.mNumTracks = numAudios;
|
||||||
|
@ -829,7 +834,8 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
|
||||||
// 11. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on the HTMLMediaElement.
|
// 11. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the AudioTrackList object referenced by the audioTracks attribute on the HTMLMediaElement.
|
||||||
mAudioTracks.mBuffers.AppendElement(TrackBuffer());
|
mAudioTracks.mBuffers.AppendElement(TrackBuffer());
|
||||||
// 10. Add the track description for this track to the track buffer.
|
// 10. Add the track description for this track to the track buffer.
|
||||||
mAudioTracks.mInfo = info.mAudio.Clone();
|
mAudioTracks.mInfo = new SharedTrackInfo(info.mAudio, streamID);
|
||||||
|
mAudioTracks.mLastInfo = mAudioTracks.mInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
mVideoTracks.mNumTracks = numVideos;
|
mVideoTracks.mNumTracks = numVideos;
|
||||||
|
@ -860,7 +866,8 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
|
||||||
// 11. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on the HTMLMediaElement.
|
// 11. Queue a task to fire a trusted event named addtrack, that does not bubble and is not cancelable, and that uses the TrackEvent interface, at the VideoTrackList object referenced by the videoTracks attribute on the HTMLMediaElement.
|
||||||
mVideoTracks.mBuffers.AppendElement(TrackBuffer());
|
mVideoTracks.mBuffers.AppendElement(TrackBuffer());
|
||||||
// 10. Add the track description for this track to the track buffer.
|
// 10. Add the track description for this track to the track buffer.
|
||||||
mVideoTracks.mInfo = info.mVideo.Clone();
|
mVideoTracks.mInfo = new SharedTrackInfo(info.mVideo, streamID);
|
||||||
|
mVideoTracks.mLastInfo = mVideoTracks.mInfo;
|
||||||
}
|
}
|
||||||
// 4. For each text track in the initialization segment, run following steps:
|
// 4. For each text track in the initialization segment, run following steps:
|
||||||
// 5. If active track flag equals true, then run the following steps:
|
// 5. If active track flag equals true, then run the following steps:
|
||||||
|
@ -868,6 +875,9 @@ TrackBuffersManager::OnDemuxerInitDone(nsresult)
|
||||||
|
|
||||||
// 6. Set first initialization segment received flag to true.
|
// 6. Set first initialization segment received flag to true.
|
||||||
mFirstInitializationSegmentReceived = true;
|
mFirstInitializationSegmentReceived = true;
|
||||||
|
} else {
|
||||||
|
mAudioTracks.mLastInfo = new SharedTrackInfo(info.mAudio, streamID);
|
||||||
|
mVideoTracks.mLastInfo = new SharedTrackInfo(info.mVideo, streamID);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO CHECK ENCRYPTION
|
// TODO CHECK ENCRYPTION
|
||||||
|
@ -1316,6 +1326,8 @@ TrackBuffersManager::ProcessFrame(MediaRawData* aSample,
|
||||||
// 16. Add the coded frame with the presentation timestamp, decode timestamp, and frame duration to the track buffer.
|
// 16. Add the coded frame with the presentation timestamp, decode timestamp, and frame duration to the track buffer.
|
||||||
aSample->mTime = presentationTimestamp.ToMicroseconds();
|
aSample->mTime = presentationTimestamp.ToMicroseconds();
|
||||||
aSample->mTimecode = decodeTimestamp.ToMicroseconds();
|
aSample->mTimecode = decodeTimestamp.ToMicroseconds();
|
||||||
|
aSample->mTrackInfo = trackBuffer.mLastInfo;
|
||||||
|
|
||||||
if (firstRemovedIndex >= 0) {
|
if (firstRemovedIndex >= 0) {
|
||||||
data.InsertElementAt(firstRemovedIndex, aSample);
|
data.InsertElementAt(firstRemovedIndex, aSample);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -217,7 +217,9 @@ private:
|
||||||
// Byte size of all samples contained in this track buffer.
|
// Byte size of all samples contained in this track buffer.
|
||||||
uint32_t mSizeBuffer;
|
uint32_t mSizeBuffer;
|
||||||
// TrackInfo of the first metadata received.
|
// TrackInfo of the first metadata received.
|
||||||
UniquePtr<TrackInfo> mInfo;
|
nsRefPtr<SharedTrackInfo> mInfo;
|
||||||
|
// TrackInfo of the last metadata parsed (updated with each init segment.
|
||||||
|
nsRefPtr<SharedTrackInfo> mLastInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool ProcessFrame(MediaRawData* aSample, TrackData& aTrackData);
|
bool ProcessFrame(MediaRawData* aSample, TrackData& aTrackData);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче