OLD | NEW |
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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 25 matching lines...) Expand all Loading... |
36 void CompletePendingReadIfPossible(); | 36 void CompletePendingReadIfPossible(); |
37 void Shutdown(); | 37 void Shutdown(); |
38 | 38 |
39 // SourceBufferStream manipulation methods. | 39 // SourceBufferStream manipulation methods. |
40 void Seek(base::TimeDelta time); | 40 void Seek(base::TimeDelta time); |
41 bool IsSeekWaitingForData() const; | 41 bool IsSeekWaitingForData() const; |
42 | 42 |
43 // Add buffers to this stream. Buffers are stored in SourceBufferStreams, | 43 // Add buffers to this stream. Buffers are stored in SourceBufferStreams, |
44 // which handle ordering and overlap resolution. | 44 // which handle ordering and overlap resolution. |
45 // Returns true if buffers were successfully added. | 45 // Returns true if buffers were successfully added. |
46 bool Append(const StreamParser::BufferQueue& buffers); | 46 bool Append(const StreamParser::BufferQueue& buffers, |
| 47 base::TimeDelta media_time); |
47 | 48 |
48 // Removes buffers between |start| and |end| according to the steps | 49 // Removes buffers between |start| and |end| according to the steps |
49 // in the "Coded Frame Removal Algorithm" in the Media Source | 50 // in the "Coded Frame Removal Algorithm" in the Media Source |
50 // Extensions Spec. | 51 // Extensions Spec. |
51 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc
e.html#sourcebuffer-coded-frame-removal | 52 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc
e.html#sourcebuffer-coded-frame-removal |
52 // | 53 // |
53 // |duration| is the current duration of the presentation. It is | 54 // |duration| is the current duration of the presentation. It is |
54 // required by the computation outlined in the spec. | 55 // required by the computation outlined in the spec. |
55 void Remove(base::TimeDelta start, base::TimeDelta end, | 56 void Remove(base::TimeDelta start, base::TimeDelta end, |
56 base::TimeDelta duration); | 57 base::TimeDelta duration); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 // TODO(wolenetz/acolwell): Protect against possible double-locking by first | 361 // TODO(wolenetz/acolwell): Protect against possible double-locking by first |
361 // releasing |lock_| before executing this callback. See | 362 // releasing |lock_| before executing this callback. See |
362 // http://crbug.com/308226 | 363 // http://crbug.com/308226 |
363 PipelineStatusCB seek_cb_; | 364 PipelineStatusCB seek_cb_; |
364 | 365 |
365 scoped_ptr<ChunkDemuxerStream> audio_; | 366 scoped_ptr<ChunkDemuxerStream> audio_; |
366 scoped_ptr<ChunkDemuxerStream> video_; | 367 scoped_ptr<ChunkDemuxerStream> video_; |
367 | 368 |
368 base::TimeDelta duration_; | 369 base::TimeDelta duration_; |
369 | 370 |
| 371 // Current media time used to prevent garbage collecting buffers |
| 372 // between the media time and the source buffer read position. |
| 373 base::TimeDelta media_time_; |
| 374 |
370 // The duration passed to the last SetDuration(). If | 375 // The duration passed to the last SetDuration(). If |
371 // SetDuration() is never called or an AppendData() call or | 376 // SetDuration() is never called or an AppendData() call or |
372 // a EndOfStream() call changes |duration_|, then this | 377 // a EndOfStream() call changes |duration_|, then this |
373 // variable is set to < 0 to indicate that the |duration_| represents | 378 // variable is set to < 0 to indicate that the |duration_| represents |
374 // the actual duration instead of a user specified value. | 379 // the actual duration instead of a user specified value. |
375 double user_specified_duration_; | 380 double user_specified_duration_; |
376 | 381 |
377 base::Time timeline_offset_; | 382 base::Time timeline_offset_; |
378 Liveness liveness_; | 383 Liveness liveness_; |
379 | 384 |
380 typedef std::map<std::string, SourceState*> SourceStateMap; | 385 typedef std::map<std::string, SourceState*> SourceStateMap; |
381 SourceStateMap source_state_map_; | 386 SourceStateMap source_state_map_; |
382 | 387 |
383 // Used to ensure that (1) config data matches the type and codec provided in | 388 // Used to ensure that (1) config data matches the type and codec provided in |
384 // AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be | 389 // AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be |
385 // removed with RemoveID() but can not be re-added (yet). | 390 // removed with RemoveID() but can not be re-added (yet). |
386 std::string source_id_audio_; | 391 std::string source_id_audio_; |
387 std::string source_id_video_; | 392 std::string source_id_video_; |
388 | 393 |
389 // Indicates that splice frame generation is enabled. | 394 // Indicates that splice frame generation is enabled. |
390 const bool splice_frames_enabled_; | 395 const bool splice_frames_enabled_; |
391 | 396 |
392 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); | 397 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); |
393 }; | 398 }; |
394 | 399 |
395 } // namespace media | 400 } // namespace media |
396 | 401 |
397 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ | 402 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ |
OLD | NEW |