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

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

Issue 1089873006: WIP - MSE: Drop non-keyframes that lack keyframe dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Checkpoint of WIP while I work on prereq https://codereview.chromium.org/1091293005/ Created 5 years, 8 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/filters/frame_processor.cc ('k') | media/filters/source_buffer_stream_unittest.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 // SourceBufferStream is a data structure that stores media Buffers in ranges. 5 // SourceBufferStream is a data structure that stores media Buffers in ranges.
6 // Buffers can be appended out of presentation order. Buffers are retrieved by 6 // Buffers can be appended out of presentation order. Buffers are retrieved by
7 // seeking to the desired start point and calling GetNextBuffer(). Buffers are 7 // seeking to the desired start point and calling GetNextBuffer(). Buffers are
8 // returned in sequential presentation order. 8 // returned in sequential presentation order.
9 9
10 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ 10 #ifndef MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_
11 #define MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ 11 #define MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_
12 12
13 #include <deque> 13 #include <deque>
14 #include <list> 14 #include <list>
15 #include <string> 15 #include <string>
16 #include <utility> 16 #include <utility>
17 #include <vector> 17 #include <vector>
18 18
19 #include "base/callback_forward.h"
19 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
20 #include "media/base/audio_decoder_config.h" 21 #include "media/base/audio_decoder_config.h"
21 #include "media/base/media_export.h" 22 #include "media/base/media_export.h"
22 #include "media/base/media_log.h" 23 #include "media/base/media_log.h"
23 #include "media/base/ranges.h" 24 #include "media/base/ranges.h"
24 #include "media/base/stream_parser_buffer.h" 25 #include "media/base/stream_parser_buffer.h"
25 #include "media/base/text_track_config.h" 26 #include "media/base/text_track_config.h"
26 #include "media/base/video_decoder_config.h" 27 #include "media/base/video_decoder_config.h"
27 28
28 namespace media { 29 namespace media {
29 30
30 class SourceBufferRange; 31 class SourceBufferRange;
31 32
32 // See file-level comment for complete description. 33 // See file-level comment for complete description.
33 class MEDIA_EXPORT SourceBufferStream { 34 class MEDIA_EXPORT SourceBufferStream {
34 public: 35 public:
35 typedef StreamParser::BufferQueue BufferQueue; 36 typedef StreamParser::BufferQueue BufferQueue;
36 typedef std::list<SourceBufferRange*> RangeList; 37 typedef std::list<SourceBufferRange*> RangeList;
38 typedef base::Callback<bool(DecodeTimestamp start_dts,
39 DecodeTimestamp end_dts)> NotifyRangeRemovalCB;
37 40
38 // Status returned by GetNextBuffer(). 41 // Status returned by GetNextBuffer().
39 // kSuccess: Indicates that the next buffer was returned. 42 // kSuccess: Indicates that the next buffer was returned.
40 // kNeedBuffer: Indicates that we need more data before a buffer can be 43 // kNeedBuffer: Indicates that we need more data before a buffer can be
41 // returned. 44 // returned.
42 // kConfigChange: Indicates that the next buffer requires a config change. 45 // kConfigChange: Indicates that the next buffer requires a config change.
43 enum Status { 46 enum Status {
44 kSuccess, 47 kSuccess,
45 kNeedBuffer, 48 kNeedBuffer,
46 kConfigChange, 49 kConfigChange,
(...skipping 11 matching lines...) Expand all
58 bool splice_frames_enabled); 61 bool splice_frames_enabled);
59 SourceBufferStream(const VideoDecoderConfig& video_config, 62 SourceBufferStream(const VideoDecoderConfig& video_config,
60 const LogCB& log_cb, 63 const LogCB& log_cb,
61 bool splice_frames_enabled); 64 bool splice_frames_enabled);
62 SourceBufferStream(const TextTrackConfig& text_config, 65 SourceBufferStream(const TextTrackConfig& text_config,
63 const LogCB& log_cb, 66 const LogCB& log_cb,
64 bool splice_frames_enabled); 67 bool splice_frames_enabled);
65 68
66 ~SourceBufferStream(); 69 ~SourceBufferStream();
67 70
71 // Allows callers to register for notification of range removal. The
72 // registration must be valid during any range removal algorithm execution, as
73 // can result from duration truncation, explicit Remove(), or garbage
74 // collection. Coded frame removals done during Append are not included (nor
75 // should they be according to MSE spec.)
76 void set_range_removal_cb(const NotifyRangeRemovalCB& range_removal_cb) {
77 range_removal_cb_ = range_removal_cb;
78 }
79
68 // Signals that the next buffers appended are part of a new media segment 80 // Signals that the next buffers appended are part of a new media segment
69 // starting at |media_segment_start_time|. 81 // starting at |media_segment_start_time|.
70 // TODO(acolwell/wolenetz): This should be changed to a presentation 82 // TODO(acolwell/wolenetz): This should be changed to a presentation
71 // timestamp. See http://crbug.com/402502 83 // timestamp. See http://crbug.com/402502
72 void OnNewMediaSegment(DecodeTimestamp media_segment_start_time); 84 void OnNewMediaSegment(DecodeTimestamp media_segment_start_time);
73 85
74 // Add the |buffers| to the SourceBufferStream. Buffers within the queue are 86 // Add the |buffers| to the SourceBufferStream. Buffers within the queue are
75 // expected to be in order, but multiple calls to Append() may add buffers out 87 // expected to be in order, but multiple calls to Append() may add buffers out
76 // of order or overlapping. Assumes all buffers within |buffers| are in 88 // of order or overlapping. Assumes all buffers within |buffers| are in
77 // presentation order and are non-overlapping. 89 // presentation order and are non-overlapping.
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 void GenerateSpliceFrame(const BufferQueue& new_buffers); 334 void GenerateSpliceFrame(const BufferQueue& new_buffers);
323 335
324 // If |out_buffer| has splice buffers or preroll, sets |pending_buffer_| 336 // If |out_buffer| has splice buffers or preroll, sets |pending_buffer_|
325 // appropriately and returns true. Otherwise returns false. 337 // appropriately and returns true. Otherwise returns false.
326 bool SetPendingBuffer(scoped_refptr<StreamParserBuffer>* out_buffer); 338 bool SetPendingBuffer(scoped_refptr<StreamParserBuffer>* out_buffer);
327 339
328 // Callback used to report log messages that can help the web developer figure 340 // Callback used to report log messages that can help the web developer figure
329 // out what is wrong with the content. 341 // out what is wrong with the content.
330 LogCB log_cb_; 342 LogCB log_cb_;
331 343
344 // Callback used to report range removal to support detection and processing
345 // by the MSE Coded Frame Processing Algorithm's of an append discontinuity
346 // that may have been introduced by the range's removal.
347 NotifyRangeRemovalCB range_removal_cb_;
348
332 // List of disjoint buffered ranges, ordered by start time. 349 // List of disjoint buffered ranges, ordered by start time.
333 RangeList ranges_; 350 RangeList ranges_;
334 351
335 // Indicates which decoder config is being used by the decoder. 352 // Indicates which decoder config is being used by the decoder.
336 // GetNextBuffer() is only allows to return buffers that have a 353 // GetNextBuffer() is only allows to return buffers that have a
337 // config ID that matches this index. If there is a mismatch then 354 // config ID that matches this index. If there is a mismatch then
338 // it must signal that a config change is needed. 355 // it must signal that a config change is needed.
339 int current_config_index_; 356 int current_config_index_;
340 357
341 // Indicates which decoder config to associate with new buffers 358 // Indicates which decoder config to associate with new buffers
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 432
416 // Indicates that splice frame generation is enabled. 433 // Indicates that splice frame generation is enabled.
417 const bool splice_frames_enabled_; 434 const bool splice_frames_enabled_;
418 435
419 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream); 436 DISALLOW_COPY_AND_ASSIGN(SourceBufferStream);
420 }; 437 };
421 438
422 } // namespace media 439 } // namespace media
423 440
424 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_ 441 #endif // MEDIA_FILTERS_SOURCE_BUFFER_STREAM_H_
OLDNEW
« no previous file with comments | « media/filters/frame_processor.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698