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

Unified Diff: media/base/media_track.h

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 to ToT 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
« no previous file with comments | « content/renderer/media/webmediaplayer_ms_unittest.cc ('k') | media/base/media_tracks.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media_track.h
diff --git a/media/base/media_track.h b/media/base/media_track.h
index 3cd41d736ffa05cd702b6402e5ad91a57b300ada..1b97622d966aa41e06dda4cae298823b55198b50 100644
--- a/media/base/media_track.h
+++ b/media/base/media_track.h
@@ -15,6 +15,7 @@ namespace media {
class MEDIA_EXPORT MediaTrack {
public:
enum Type { Text, Audio, Video };
+ using Id = std::string;
MediaTrack(Type type,
StreamParser::TrackId bytestream_track_id,
const std::string& kind,
@@ -31,9 +32,29 @@ class MEDIA_EXPORT MediaTrack {
const std::string& label() const { return label_; }
const std::string& language() const { return language_; }
+ Id id() const { return id_; }
+ void set_id(Id id) {
+ DCHECK(id_.empty());
+ DCHECK(!id.empty());
+ id_ = id;
+ }
+
private:
Type type_;
+
+ // |bytestream_track_id_| is read from the bytestream and is guaranteed to be
+ // unique only within the scope of single bytestream's initialization segment.
+ // But we might have multiple bytestreams (MediaSource might have multiple
+ // SourceBuffers attached to it, which translates into ChunkDemuxer having
+ // multiple MediaSourceStates and multiple bytestreams) or subsequent init
+ // segments may redefine the bytestream ids. Thus bytestream track ids are not
+ // guaranteed to be unique at the Demuxer and HTMLMediaElement level. So we
+ // generate truly unique media track |id_| on the Demuxer level.
StreamParser::TrackId bytestream_track_id_;
+ Id id_;
+
+ // These properties are read from input streams by stream parsers as specified
+ // in https://dev.w3.org/html5/html-sourcing-inband-tracks/.
std::string kind_;
std::string label_;
std::string language_;
« no previous file with comments | « content/renderer/media/webmediaplayer_ms_unittest.cc ('k') | media/base/media_tracks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698