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

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

Issue 2226443002: Support multiple media tracks in MSE / ChunkDemuxer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: A few clean ups Created 4 years, 3 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 void StartWaitingForSeek(base::TimeDelta seek_time) override; 210 void StartWaitingForSeek(base::TimeDelta seek_time) override;
211 void CancelPendingSeek(base::TimeDelta seek_time) override; 211 void CancelPendingSeek(base::TimeDelta seek_time) override;
212 212
213 // Registers a new |id| to use for AppendData() calls. |type| indicates 213 // Registers a new |id| to use for AppendData() calls. |type| indicates
214 // the MIME type for the data that we intend to append for this ID. 214 // the MIME type for the data that we intend to append for this ID.
215 // kOk is returned if the demuxer has enough resources to support another ID 215 // kOk is returned if the demuxer has enough resources to support another ID
216 // and supports the format indicated by |type|. 216 // and supports the format indicated by |type|.
217 // kNotSupported is returned if |type| is not a supported format. 217 // kNotSupported is returned if |type| is not a supported format.
218 // kReachedIdLimit is returned if the demuxer cannot handle another ID right 218 // kReachedIdLimit is returned if the demuxer cannot handle another ID right
219 // now. 219 // now.
220 Status AddId(const std::string& id, const std::string& type, 220 Status AddId(const std::string& id,
221 std::vector<std::string>& codecs); 221 const std::string& type,
222 const std::string& codecs);
222 223
223 // Notifies a caller via |tracks_updated_cb| that the set of media tracks 224 // Notifies a caller via |tracks_updated_cb| that the set of media tracks
224 // for a given |id| has changed. 225 // for a given |id| has changed.
225 void SetTracksWatcher(const std::string& id, 226 void SetTracksWatcher(const std::string& id,
226 const MediaTracksUpdatedCB& tracks_updated_cb); 227 const MediaTracksUpdatedCB& tracks_updated_cb);
227 228
228 // Removed an ID & associated resources that were previously added with 229 // Removed an ID & associated resources that were previously added with
229 // AddId(). 230 // AddId().
230 void RemoveId(const std::string& id); 231 void RemoveId(const std::string& id);
231 232
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 // MediaLog for reporting messages and properties to debug content and engine. 402 // MediaLog for reporting messages and properties to debug content and engine.
402 scoped_refptr<MediaLog> media_log_; 403 scoped_refptr<MediaLog> media_log_;
403 404
404 PipelineStatusCB init_cb_; 405 PipelineStatusCB init_cb_;
405 // Callback to execute upon seek completion. 406 // Callback to execute upon seek completion.
406 // TODO(wolenetz/acolwell): Protect against possible double-locking by first 407 // TODO(wolenetz/acolwell): Protect against possible double-locking by first
407 // releasing |lock_| before executing this callback. See 408 // releasing |lock_| before executing this callback. See
408 // http://crbug.com/308226 409 // http://crbug.com/308226
409 PipelineStatusCB seek_cb_; 410 PipelineStatusCB seek_cb_;
410 411
411 std::unique_ptr<ChunkDemuxerStream> audio_; 412 std::vector<std::unique_ptr<ChunkDemuxerStream>> audio_streams_;
412 std::unique_ptr<ChunkDemuxerStream> video_; 413 std::vector<std::unique_ptr<ChunkDemuxerStream>> video_streams_;
413 414
414 // Counter to ensure that we do not transition too early to INITIALIZED. 415 // Counter to ensure that we do not transition too early to INITIALIZED.
415 // Incremented in AddId(), decremented in OnSourceInitDone(). 416 // Incremented in AddId(), decremented in OnSourceInitDone().
416 int pending_source_init_done_count_; 417 int pending_source_init_done_count_;
417 418
418 base::TimeDelta duration_; 419 base::TimeDelta duration_;
419 420
420 // The duration passed to the last SetDuration(). If 421 // The duration passed to the last SetDuration(). If
421 // SetDuration() is never called or an AppendData() call or 422 // SetDuration() is never called or an AppendData() call or
422 // a EndOfStream() call changes |duration_|, then this 423 // a EndOfStream() call changes |duration_|, then this
423 // variable is set to < 0 to indicate that the |duration_| represents 424 // variable is set to < 0 to indicate that the |duration_| represents
424 // the actual duration instead of a user specified value. 425 // the actual duration instead of a user specified value.
425 double user_specified_duration_; 426 double user_specified_duration_;
426 427
427 base::Time timeline_offset_; 428 base::Time timeline_offset_;
428 DemuxerStream::Liveness liveness_; 429 DemuxerStream::Liveness liveness_;
429 430
430 typedef std::map<std::string, MediaSourceState*> MediaSourceStateMap; 431 typedef std::map<std::string, MediaSourceState*> MediaSourceStateMap;
431 MediaSourceStateMap source_state_map_; 432 MediaSourceStateMap source_state_map_;
432 433
433 // Used to ensure that (1) config data matches the type and codec provided in
434 // AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be
435 // removed with RemoveID() but can not be re-added (yet).
436 std::string source_id_audio_;
437 std::string source_id_video_;
438
439 // Indicates that splice frame generation is enabled. 434 // Indicates that splice frame generation is enabled.
440 const bool splice_frames_enabled_; 435 const bool splice_frames_enabled_;
441 436
442 // Accumulate, by type, detected track counts across the SourceBuffers. 437 // Accumulate, by type, detected track counts across the SourceBuffers.
443 int detected_audio_track_count_; 438 int detected_audio_track_count_;
444 int detected_video_track_count_; 439 int detected_video_track_count_;
445 int detected_text_track_count_; 440 int detected_text_track_count_;
446 441
447 std::map<MediaTrack::Id, const DemuxerStream*> track_id_to_demux_stream_map_; 442 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_;
448 443
449 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 444 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
450 }; 445 };
451 446
452 } // namespace media 447 } // namespace media
453 448
454 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 449 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698