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

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 Created 4 years, 5 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
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void UnmarkEndOfStream(); 104 void UnmarkEndOfStream();
105 105
106 // DemuxerStream methods. 106 // DemuxerStream methods.
107 void Read(const ReadCB& read_cb) override; 107 void Read(const ReadCB& read_cb) override;
108 Type type() const override; 108 Type type() const override;
109 Liveness liveness() const override; 109 Liveness liveness() const override;
110 AudioDecoderConfig audio_decoder_config() override; 110 AudioDecoderConfig audio_decoder_config() override;
111 VideoDecoderConfig video_decoder_config() override; 111 VideoDecoderConfig video_decoder_config() override;
112 bool SupportsConfigChanges() override; 112 bool SupportsConfigChanges() override;
113 VideoRotation video_rotation() override; 113 VideoRotation video_rotation() override;
114 bool enabled() const override;
115 void set_enabled(bool enabled, base::TimeDelta timestamp) override;
116 void SetStreamRestartedCB(const StreamRestartedCB& cb) override;
114 117
115 // Returns the text track configuration. It is an error to call this method 118 // Returns the text track configuration. It is an error to call this method
116 // if type() != TEXT. 119 // if type() != TEXT.
117 TextTrackConfig text_track_config(); 120 TextTrackConfig text_track_config();
118 121
119 // Sets the memory limit, in bytes, on the SourceBufferStream. 122 // Sets the memory limit, in bytes, on the SourceBufferStream.
120 void SetStreamMemoryLimit(size_t memory_limit); 123 void SetStreamMemoryLimit(size_t memory_limit);
121 124
122 bool supports_partial_append_window_trimming() const { 125 bool supports_partial_append_window_trimming() const {
123 return partial_append_window_trimming_enabled_; 126 return partial_append_window_trimming_enabled_;
(...skipping 23 matching lines...) Expand all
147 150
148 std::unique_ptr<SourceBufferStream> stream_; 151 std::unique_ptr<SourceBufferStream> stream_;
149 152
150 const MediaTrack::Id media_track_id_; 153 const MediaTrack::Id media_track_id_;
151 154
152 mutable base::Lock lock_; 155 mutable base::Lock lock_;
153 State state_; 156 State state_;
154 ReadCB read_cb_; 157 ReadCB read_cb_;
155 bool splice_frames_enabled_; 158 bool splice_frames_enabled_;
156 bool partial_append_window_trimming_enabled_; 159 bool partial_append_window_trimming_enabled_;
160 bool is_enabled_;
161 StreamRestartedCB stream_restarted_cb_;
157 162
158 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); 163 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
159 }; 164 };
160 165
161 // Demuxer implementation that allows chunks of media data to be passed 166 // Demuxer implementation that allows chunks of media data to be passed
162 // from JavaScript to the media stack. 167 // from JavaScript to the media stack.
163 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { 168 class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
164 public: 169 public:
165 enum Status { 170 enum Status {
166 kOk, // ID added w/o error. 171 kOk, // ID added w/o error.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // AddId(). 228 // AddId().
224 void RemoveId(const std::string& id); 229 void RemoveId(const std::string& id);
225 230
226 // Gets the currently buffered ranges for the specified ID. 231 // Gets the currently buffered ranges for the specified ID.
227 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const; 232 Ranges<base::TimeDelta> GetBufferedRanges(const std::string& id) const;
228 233
229 // Gets the highest buffered PTS for the specified |id|. If there is nothing 234 // Gets the highest buffered PTS for the specified |id|. If there is nothing
230 // buffered, returns base::TimeDelta(). 235 // buffered, returns base::TimeDelta().
231 base::TimeDelta GetHighestPresentationTimestamp(const std::string& id) const; 236 base::TimeDelta GetHighestPresentationTimestamp(const std::string& id) const;
232 237
238 void OnEnabledAudioTracksChanged(const std::vector<MediaTrack::Id>& track_ids,
239 base::TimeDelta currTime) override;
240 // |track_ids| is either empty or contains a single video track id.
241 void OnSelectedVideoTrackChanged(const std::vector<MediaTrack::Id>& track_ids,
242 base::TimeDelta currTime) override;
243
233 // Appends media data to the source buffer associated with |id|, applying 244 // Appends media data to the source buffer associated with |id|, applying
234 // and possibly updating |*timestamp_offset| during coded frame processing. 245 // and possibly updating |*timestamp_offset| during coded frame processing.
235 // |append_window_start| and |append_window_end| correspond to the MSE spec's 246 // |append_window_start| and |append_window_end| correspond to the MSE spec's
236 // similarly named source buffer attributes that are used in coded frame 247 // similarly named source buffer attributes that are used in coded frame
237 // processing. Returns true on success, false if the caller needs to run the 248 // processing. Returns true on success, false if the caller needs to run the
238 // append error algorithm with decode error parameter set to true. 249 // append error algorithm with decode error parameter set to true.
239 bool AppendData(const std::string& id, 250 bool AppendData(const std::string& id,
240 const uint8_t* data, 251 const uint8_t* data,
241 size_t length, 252 size_t length,
242 base::TimeDelta append_window_start, 253 base::TimeDelta append_window_start,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 std::string source_id_video_; 437 std::string source_id_video_;
427 438
428 // Indicates that splice frame generation is enabled. 439 // Indicates that splice frame generation is enabled.
429 const bool splice_frames_enabled_; 440 const bool splice_frames_enabled_;
430 441
431 // Accumulate, by type, detected track counts across the SourceBuffers. 442 // Accumulate, by type, detected track counts across the SourceBuffers.
432 int detected_audio_track_count_; 443 int detected_audio_track_count_;
433 int detected_video_track_count_; 444 int detected_video_track_count_;
434 int detected_text_track_count_; 445 int detected_text_track_count_;
435 446
447 std::map<MediaTrack::Id, const DemuxerStream*> track_id_to_demux_stream_map_;
448
436 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 449 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
437 }; 450 };
438 451
439 } // namespace media 452 } // namespace media
440 453
441 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 454 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698