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

Unified Diff: media/filters/chunk_demuxer.h

Issue 191513002: Extract coded frame processing from SourceState into LegacyFrameProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some lint errors Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/filters/chunk_demuxer.cc » ('j') | media/filters/chunk_demuxer.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/chunk_demuxer.h
diff --git a/media/filters/chunk_demuxer.h b/media/filters/chunk_demuxer.h
index 1f4fb2629e3185588c17fc3b3b231e992c13e19e..dd5c3c73f4cffcfa04b2a24924b971a3c75cbc1e 100644
--- a/media/filters/chunk_demuxer.h
+++ b/media/filters/chunk_demuxer.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_FILTERS_CHUNK_DEMUXER_H_
#define MEDIA_FILTERS_CHUNK_DEMUXER_H_
+#include <deque>
#include <map>
#include <string>
#include <utility>
@@ -19,10 +20,106 @@
namespace media {
-class ChunkDemuxerStream;
class FFmpegURLProtocol;
class SourceState;
+class ChunkDemuxerStream : public DemuxerStream {
+ public:
+ typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue;
+
+ explicit ChunkDemuxerStream(Type type);
+ virtual ~ChunkDemuxerStream();
+
+ // ChunkDemuxerStream control methods.
+ void StartReturningData();
+ void AbortReads();
+ void CompletePendingReadIfPossible();
+ void Shutdown();
+
+ // SourceBufferStream manipulation methods.
+ void Seek(base::TimeDelta time);
+ bool IsSeekWaitingForData() const;
+
+ // Add buffers to this stream. Buffers are stored in SourceBufferStreams,
+ // which handle ordering and overlap resolution.
+ // Returns true if buffers were successfully added.
+ bool Append(const StreamParser::BufferQueue& buffers);
+
+ // Removes buffers between |start| and |end| according to the steps
+ // in the "Coded Frame Removal Algorithm" in the Media Source
+ // Extensions Spec.
+ // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-source.html#sourcebuffer-coded-frame-removal
+ //
+ // |duration| is the current duration of the presentation. It is
+ // required by the computation outlined in the spec.
+ void Remove(base::TimeDelta start, base::TimeDelta end,
+ base::TimeDelta duration);
+
+ // Signal to the stream that duration has changed to |duration|.
+ void OnSetDuration(base::TimeDelta duration);
+
+ // Returns the range of buffered data in this stream, capped at |duration|.
+ Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const;
+
+ // Returns the duration of the buffered data.
+ // Returns base::TimeDelta() if the stream has no buffered data.
+ base::TimeDelta GetBufferedDuration() const;
+
+ // Signal to the stream that buffers handed in through subsequent calls to
+ // Append() belong to a media segment that starts at |start_timestamp|.
+ void OnNewMediaSegment(base::TimeDelta start_timestamp);
+
+ // Called when midstream config updates occur.
+ // Returns true if the new config is accepted.
+ // Returns false if the new config should trigger an error.
+ bool UpdateAudioConfig(const AudioDecoderConfig& config, const LogCB& log_cb);
+ bool UpdateVideoConfig(const VideoDecoderConfig& config, const LogCB& log_cb);
+ void UpdateTextConfig(const TextTrackConfig& config, const LogCB& log_cb);
+
+ void MarkEndOfStream();
+ void UnmarkEndOfStream();
+
+ // DemuxerStream methods.
+ virtual void Read(const ReadCB& read_cb) OVERRIDE;
+ virtual Type type() OVERRIDE;
+ virtual void EnableBitstreamConverter() OVERRIDE;
+ virtual AudioDecoderConfig audio_decoder_config() OVERRIDE;
+ virtual VideoDecoderConfig video_decoder_config() OVERRIDE;
+
+ // Returns the text track configuration. It is an error to call this method
+ // if type() != TEXT.
+ TextTrackConfig text_track_config();
+
+ // Sets the memory limit, in bytes, on the SourceBufferStream.
+ void set_memory_limit_for_testing(int memory_limit) {
+ stream_->set_memory_limit_for_testing(memory_limit);
+ }
+
+ private:
+ enum State {
+ UNINITIALIZED,
+ RETURNING_DATA_FOR_READS,
+ RETURNING_ABORT_FOR_READS,
+ SHUTDOWN,
+ };
+
+ // Assigns |state_| to |state|
+ void ChangeState_Locked(State state);
+
+ void CompletePendingReadIfPossible_Locked();
+
+ // Specifies the type of the stream.
+ Type type_;
+
+ scoped_ptr<SourceBufferStream> stream_;
+
+ mutable base::Lock lock_;
+ State state_;
+ ReadCB read_cb_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
+};
+
// Demuxer implementation that allows chunks of media data to be passed
// from JavaScript to the media stack.
class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
« no previous file with comments | « no previous file | media/filters/chunk_demuxer.cc » ('j') | media/filters/chunk_demuxer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698