Chromium Code Reviews| Index: media/base/media_track.h |
| diff --git a/media/base/media_track.h b/media/base/media_track.h |
| index 3cd41d736ffa05cd702b6402e5ad91a57b300ada..df1165c957a722136551c9d1ce887fc09e01224d 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,28 @@ 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; |
| + } |
|
xhwang
2016/06/10 17:06:53
I wonder whether we can generate this ID when we c
servolk
2016/06/10 22:05:25
I don't think we can simplify this much further. I
|
| + |
| private: |
| Type type_; |
| + |
| + // |bytestream_track_id_| is read from the bytestream and is guaranteed to be |
| + // unique only within the scope of single bytestream. But we might have |
| + // multiple bytestreams (MediaSource might have multiple SourceBuffers |
| + // attached to it, which translates into ChunkDemuxer having multiple |
| + // MediaSourceStates and multiple bytestreams). 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. |
|
xhwang
2016/06/10 17:06:54
I <3 this comment. Thanks!
servolk
2016/06/10 22:05:25
Acknowledged.
|
| StreamParser::TrackId bytestream_track_id_; |
|
xhwang
2016/06/10 17:06:53
nit: I wonder whether StreamParser::TrackId should
servolk
2016/06/10 22:05:25
Yes, I think we could rename StreamParser::TrackId
|
| + 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_; |