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

Side by Side Diff: media/filters/chunk_demuxer.h

Issue 1935873002: Implement disabling and enabling media tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-control2
Patch Set: rebase + buildfix 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_ 5 #ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_
6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_ 6 #define MEDIA_FILTERS_CHUNK_DEMUXER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void UnmarkEndOfStream(); 100 void UnmarkEndOfStream();
101 101
102 // DemuxerStream methods. 102 // DemuxerStream methods.
103 void Read(const ReadCB& read_cb) override; 103 void Read(const ReadCB& read_cb) override;
104 Type type() const override; 104 Type type() const override;
105 Liveness liveness() const override; 105 Liveness liveness() const override;
106 AudioDecoderConfig audio_decoder_config() override; 106 AudioDecoderConfig audio_decoder_config() override;
107 VideoDecoderConfig video_decoder_config() override; 107 VideoDecoderConfig video_decoder_config() override;
108 bool SupportsConfigChanges() override; 108 bool SupportsConfigChanges() override;
109 VideoRotation video_rotation() override; 109 VideoRotation video_rotation() override;
110 bool enabled() const override;
111 void set_enabled(bool enabled, base::TimeDelta timestamp) override;
112 void SetStreamRestartedCB(const StreamRestartedCB& cb) override;
110 113
111 // Returns the text track configuration. It is an error to call this method 114 // Returns the text track configuration. It is an error to call this method
112 // if type() != TEXT. 115 // if type() != TEXT.
113 TextTrackConfig text_track_config(); 116 TextTrackConfig text_track_config();
114 117
115 // Sets the memory limit, in bytes, on the SourceBufferStream. 118 // Sets the memory limit, in bytes, on the SourceBufferStream.
116 void SetStreamMemoryLimit(size_t memory_limit); 119 void SetStreamMemoryLimit(size_t memory_limit);
117 120
118 bool supports_partial_append_window_trimming() const { 121 bool supports_partial_append_window_trimming() const {
119 return partial_append_window_trimming_enabled_; 122 return partial_append_window_trimming_enabled_;
(...skipping 23 matching lines...) Expand all
143 146
144 std::unique_ptr<SourceBufferStream> stream_; 147 std::unique_ptr<SourceBufferStream> stream_;
145 148
146 const MediaTrack::Id media_track_id_; 149 const MediaTrack::Id media_track_id_;
147 150
148 mutable base::Lock lock_; 151 mutable base::Lock lock_;
149 State state_; 152 State state_;
150 ReadCB read_cb_; 153 ReadCB read_cb_;
151 bool splice_frames_enabled_; 154 bool splice_frames_enabled_;
152 bool partial_append_window_trimming_enabled_; 155 bool partial_append_window_trimming_enabled_;
156 bool is_enabled_;
157 StreamRestartedCB stream_restarted_cb_;
153 158
154 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); 159 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
155 }; 160 };
156 161
157 // Demuxer implementation that allows chunks of media data to be passed 162 // Demuxer implementation that allows chunks of media data to be passed
158 // from JavaScript to the media stack. 163 // from JavaScript to the media stack.
159 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { 164 class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
160 public: 165 public:
161 enum Status { 166 enum Status {
162 kOk, // ID added w/o error. 167 kOk, // ID added w/o error.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 void SetTracksWatcher(const std::string& id, 220 void SetTracksWatcher(const std::string& id,
216 const MediaTracksUpdatedCB& tracks_updated_cb); 221 const MediaTracksUpdatedCB& tracks_updated_cb);
217 222
218 // Removed an ID & associated resources that were previously added with 223 // Removed an ID & associated resources that were previously added with
219 // AddId(). 224 // AddId().
220 void RemoveId(const std::string& id); 225 void RemoveId(const std::string& id);
221 226
222 // Gets the currently buffered ranges for the specified ID. 227 // Gets the currently buffered ranges for the specified ID.
223 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; 228 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const;
224 229
230 void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
231 base::TimeDelta currTime) override;
232 // |track_ids| is either empty or contains a single video track id.
233 void OnSelectedVideoTrackChanged(const std::vector<MediaTrack::Id>& track_ids,
234 base::TimeDelta currTime) override;
235
225 // Appends media data to the source buffer associated with |id|, applying 236 // Appends media data to the source buffer associated with |id|, applying
226 // and possibly updating |*timestamp_offset| during coded frame processing. 237 // and possibly updating |*timestamp_offset| during coded frame processing.
227 // |append_window_start| and |append_window_end| correspond to the MSE spec's 238 // |append_window_start| and |append_window_end| correspond to the MSE spec's
228 // similarly named source buffer attributes that are used in coded frame 239 // similarly named source buffer attributes that are used in coded frame
229 // processing. Returns true on success, false if the caller needs to run the 240 // processing. Returns true on success, false if the caller needs to run the
230 // append error algorithm with decode error parameter set to true. 241 // append error algorithm with decode error parameter set to true.
231 bool AppendData(const std::string& id, 242 bool AppendData(const std::string& id,
232 const uint8_t* data, 243 const uint8_t* data,
233 size_t length, 244 size_t length,
234 base::TimeDelta append_window_start, 245 base::TimeDelta append_window_start,
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 int detected_audio_track_count_; 435 int detected_audio_track_count_;
425 int detected_video_track_count_; 436 int detected_video_track_count_;
426 int detected_text_track_count_; 437 int detected_text_track_count_;
427 438
428 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 439 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
429 }; 440 };
430 441
431 } // namespace media 442 } // namespace media
432 443
433 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 444 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698