Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp

Issue 2050043002: Generate and assign media track ids in demuxers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use-streamparser-trackid
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
diff --git a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
index ea97613aa50607a193833f1304a868f28a7b82ad..4c8bec3f5f5c0d10e9bbdd614994800ce72e9d5e 100644
--- a/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
+++ b/third_party/WebKit/Source/modules/mediasource/SourceBuffer.cpp
@@ -590,8 +590,10 @@ WebVector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(c
unsigned resultIdx = 0;
for (const auto& trackInfo : newTracks) {
if (!RuntimeEnabledFeatures::audioVideoTracksEnabled()) {
- static WebMediaPlayer::TrackId nextTrackId = 0;
- result[resultIdx++] = ++nextTrackId;
+ static unsigned nextTrackId = 0;
+ StringBuilder stringBuilder;
+ stringBuilder.appendNumber(++nextTrackId);
+ result[resultIdx++] = stringBuilder.toString();
continue;
}
@@ -599,12 +601,12 @@ WebVector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(c
if (trackInfo.trackType == WebMediaPlayer::AudioTrack) {
AudioTrack* audioTrack = nullptr;
if (!m_firstInitializationSegmentReceived) {
- audioTrack = AudioTrack::create(trackInfo.byteStreamTrackId, trackInfo.kind, trackInfo.label, trackInfo.language, false);
+ audioTrack = AudioTrack::create(trackInfo.id, trackInfo.kind, trackInfo.label, trackInfo.language, false);
SourceBufferTrackBaseSupplement::setSourceBuffer(*audioTrack, this);
audioTracks().add(audioTrack);
m_source->mediaElement()->audioTracks().add(audioTrack);
} else {
- audioTrack = findExistingTrackById(audioTracks(), trackInfo.byteStreamTrackId);
+ audioTrack = findExistingTrackById(audioTracks(), trackInfo.id);
DCHECK(audioTrack);
}
trackBase = audioTrack;
@@ -612,12 +614,12 @@ WebVector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(c
} else if (trackInfo.trackType == WebMediaPlayer::VideoTrack) {
VideoTrack* videoTrack = nullptr;
if (!m_firstInitializationSegmentReceived) {
- videoTrack = VideoTrack::create(trackInfo.byteStreamTrackId, trackInfo.kind, trackInfo.label, trackInfo.language, false);
+ videoTrack = VideoTrack::create(trackInfo.id, trackInfo.kind, trackInfo.label, trackInfo.language, false);
SourceBufferTrackBaseSupplement::setSourceBuffer(*videoTrack, this);
videoTracks().add(videoTrack);
m_source->mediaElement()->videoTracks().add(videoTrack);
} else {
- videoTrack = findExistingTrackById(videoTracks(), trackInfo.byteStreamTrackId);
+ videoTrack = findExistingTrackById(videoTracks(), trackInfo.id);
DCHECK(videoTrack);
}
trackBase = videoTrack;
@@ -630,8 +632,8 @@ WebVector<WebMediaPlayer::TrackId> SourceBuffer::initializationSegmentReceived(c
const char* logActionStr = m_firstInitializationSegmentReceived ? "using existing" : "added";
const char* logTrackTypeStr = (trackInfo.trackType == WebMediaPlayer::AudioTrack) ? "audio" : "video";
DVLOG(SOURCE_BUFFER_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << logActionStr << " "
- << logTrackTypeStr << " Track " << trackBase << "trackId=" << trackBase->trackId() << " id="
- << trackBase->id() << " label=" << trackBase->label() << " lang=" << trackBase->language();
+ << logTrackTypeStr << " Track " << trackBase << " trackId=" << (String)trackBase->trackId()
+ << " label=" << trackBase->label() << " lang=" << trackBase->language();
#endif
}

Powered by Google App Engine
This is Rietveld 408576698