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

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

Issue 180153003: Implement core of compliant MediaSource coded frame processing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Aligned with April 1 spec editor's draft, tests added Created 6 years, 7 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 | Annotate | Revision Log
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 <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
15 #include "media/base/byte_queue.h" 15 #include "media/base/byte_queue.h"
16 #include "media/base/demuxer.h" 16 #include "media/base/demuxer.h"
17 #include "media/base/ranges.h" 17 #include "media/base/ranges.h"
18 #include "media/base/stream_parser.h" 18 #include "media/base/stream_parser.h"
19 #include "media/filters/source_buffer_stream.h" 19 #include "media/filters/source_buffer_stream.h"
20 20
21 namespace media { 21 namespace media {
22 22
23 class FFmpegURLProtocol; 23 class FFmpegURLProtocol;
24 class SourceState; 24 class SourceState;
25 25
26 class ChunkDemuxerStream : public DemuxerStream { 26 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
27 public: 27 public:
28 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; 28 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue;
29 29
30 explicit ChunkDemuxerStream(Type type, bool splice_frames_enabled); 30 explicit ChunkDemuxerStream(Type type, bool splice_frames_enabled);
31 virtual ~ChunkDemuxerStream(); 31 virtual ~ChunkDemuxerStream();
32 32
33 // ChunkDemuxerStream control methods. 33 // ChunkDemuxerStream control methods.
34 void StartReturningData(); 34 void StartReturningData();
35 void AbortReads(); 35 void AbortReads();
36 void CompletePendingReadIfPossible(); 36 void CompletePendingReadIfPossible();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // call received before a StartWaitingForSeek() call to immediately call its 187 // call received before a StartWaitingForSeek() call to immediately call its
188 // callback without waiting for any data. 188 // callback without waiting for any data.
189 // |seek_time| - The presentation timestamp for the seek request that 189 // |seek_time| - The presentation timestamp for the seek request that
190 // triggered this call. It represents the most recent position the caller is 190 // triggered this call. It represents the most recent position the caller is
191 // trying to seek to. 191 // trying to seek to.
192 void CancelPendingSeek(base::TimeDelta seek_time); 192 void CancelPendingSeek(base::TimeDelta seek_time);
193 193
194 // Registers a new |id| to use for AppendData() calls. |type| indicates 194 // Registers a new |id| to use for AppendData() calls. |type| indicates
195 // the MIME type for the data that we intend to append for this ID. 195 // the MIME type for the data that we intend to append for this ID.
196 // |use_legacy_frame_processor| determines which of LegacyFrameProcessor or 196 // |use_legacy_frame_processor| determines which of LegacyFrameProcessor or
197 // a (not yet implemented) more compliant frame processor to use to process 197 // FrameProcessor to use to process parsed frames from AppendData() calls.
198 // parsed frames from AppendData() calls.
199 // TODO(wolenetz): Enable usage of new frame processor based on this flag.
200 // See http://crbug.com/249422.
201 // kOk is returned if the demuxer has enough resources to support another ID 198 // kOk is returned if the demuxer has enough resources to support another ID
202 // and supports the format indicated by |type|. 199 // and supports the format indicated by |type|.
203 // kNotSupported is returned if |type| is not a supported format. 200 // kNotSupported is returned if |type| is not a supported format.
204 // kReachedIdLimit is returned if the demuxer cannot handle another ID right 201 // kReachedIdLimit is returned if the demuxer cannot handle another ID right
205 // now. 202 // now.
206 Status AddId(const std::string& id, const std::string& type, 203 Status AddId(const std::string& id, const std::string& type,
207 std::vector<std::string>& codecs, 204 std::vector<std::string>& codecs,
208 const bool use_legacy_frame_processor); 205 const bool use_legacy_frame_processor);
209 206
210 // Removed an ID & associated resources that were previously added with 207 // Removed an ID & associated resources that were previously added with
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // Returns true if the source buffer associated with |id| is currently parsing 246 // Returns true if the source buffer associated with |id| is currently parsing
250 // a media segment, or false otherwise. 247 // a media segment, or false otherwise.
251 bool IsParsingMediaSegment(const std::string& id); 248 bool IsParsingMediaSegment(const std::string& id);
252 249
253 // Set the append mode to be applied to subsequent buffers appended to the 250 // Set the append mode to be applied to subsequent buffers appended to the
254 // source buffer associated with |id|. If |sequence_mode| is true, caller 251 // source buffer associated with |id|. If |sequence_mode| is true, caller
255 // is requesting "sequence" mode. Otherwise, caller is requesting "segments" 252 // is requesting "sequence" mode. Otherwise, caller is requesting "segments"
256 // mode. 253 // mode.
257 void SetSequenceMode(const std::string& id, bool sequence_mode); 254 void SetSequenceMode(const std::string& id, bool sequence_mode);
258 255
256 // Signals the coded frame processor for the source buffer associated with
257 // |id| to update its group start timestamp to be |timestamp_offset| if it is
258 // in sequence append mode.
259 void SetGroupStartTimestampIfInSequenceMode(const std::string& id,
260 base::TimeDelta timestamp_offset);
261
259 // Called to signal changes in the "end of stream" 262 // Called to signal changes in the "end of stream"
260 // state. UnmarkEndOfStream() must not be called if a matching 263 // state. UnmarkEndOfStream() must not be called if a matching
261 // MarkEndOfStream() has not come before it. 264 // MarkEndOfStream() has not come before it.
262 void MarkEndOfStream(PipelineStatus status); 265 void MarkEndOfStream(PipelineStatus status);
263 void UnmarkEndOfStream(); 266 void UnmarkEndOfStream();
264 267
265 void Shutdown(); 268 void Shutdown();
266 269
267 // Sets the memory limit on each stream. |memory_limit| is the 270 // Sets the memory limit on each stream. |memory_limit| is the
268 // maximum number of bytes each stream is allowed to hold in its buffer. 271 // maximum number of bytes each stream is allowed to hold in its buffer.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 393
391 // Indicates that splice frame generation is enabled. 394 // Indicates that splice frame generation is enabled.
392 const bool splice_frames_enabled_; 395 const bool splice_frames_enabled_;
393 396
394 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 397 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
395 }; 398 };
396 399
397 } // namespace media 400 } // namespace media
398 401
399 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 402 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698