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

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

Issue 2343543002: MSE: Replace crossfade splicing overlap trimming. (Closed)
Patch Set: Merge and feedback. Created 4 years, 1 month 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/blink/webmediaplayer_impl.cc ('k') | media/filters/chunk_demuxer.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 #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 16 matching lines...) Expand all
27 #include "media/filters/source_buffer_stream.h" 27 #include "media/filters/source_buffer_stream.h"
28 28
29 namespace media { 29 namespace media {
30 30
31 class FFmpegURLProtocol; 31 class FFmpegURLProtocol;
32 32
33 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { 33 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
34 public: 34 public:
35 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; 35 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue;
36 36
37 ChunkDemuxerStream(Type type, 37 ChunkDemuxerStream(Type type, MediaTrack::Id media_track_id);
38 bool splice_frames_enabled,
39 MediaTrack::Id media_track_id);
40 ~ChunkDemuxerStream() override; 38 ~ChunkDemuxerStream() override;
41 39
42 // ChunkDemuxerStream control methods. 40 // ChunkDemuxerStream control methods.
43 void StartReturningData(); 41 void StartReturningData();
44 void AbortReads(); 42 void AbortReads();
45 void CompletePendingReadIfPossible(); 43 void CompletePendingReadIfPossible();
46 void Shutdown(); 44 void Shutdown();
47 45
48 // SourceBufferStream manipulation methods. 46 // SourceBufferStream manipulation methods.
49 void Seek(base::TimeDelta time); 47 void Seek(base::TimeDelta time);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 147
150 Liveness liveness_; 148 Liveness liveness_;
151 149
152 std::unique_ptr<SourceBufferStream> stream_; 150 std::unique_ptr<SourceBufferStream> stream_;
153 151
154 const MediaTrack::Id media_track_id_; 152 const MediaTrack::Id media_track_id_;
155 153
156 mutable base::Lock lock_; 154 mutable base::Lock lock_;
157 State state_; 155 State state_;
158 ReadCB read_cb_; 156 ReadCB read_cb_;
159 bool splice_frames_enabled_;
160 bool partial_append_window_trimming_enabled_; 157 bool partial_append_window_trimming_enabled_;
161 bool is_enabled_; 158 bool is_enabled_;
162 StreamStatusChangeCB stream_status_change_cb_; 159 StreamStatusChangeCB stream_status_change_cb_;
163 160
164 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); 161 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
165 }; 162 };
166 163
167 // Demuxer implementation that allows chunks of media data to be passed 164 // Demuxer implementation that allows chunks of media data to be passed
168 // from JavaScript to the media stack. 165 // from JavaScript to the media stack.
169 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { 166 class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
170 public: 167 public:
171 enum Status { 168 enum Status {
172 kOk, // ID added w/o error. 169 kOk, // ID added w/o error.
173 kNotSupported, // Type specified is not supported. 170 kNotSupported, // Type specified is not supported.
174 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. 171 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs.
175 }; 172 };
176 173
177 // |open_cb| Run when Initialize() is called to signal that the demuxer 174 // |open_cb| Run when Initialize() is called to signal that the demuxer
178 // is ready to receive media data via AppenData(). 175 // is ready to receive media data via AppenData().
179 // |encrypted_media_init_data_cb| Run when the demuxer determines that an 176 // |encrypted_media_init_data_cb| Run when the demuxer determines that an
180 // encryption key is needed to decrypt the content. 177 // encryption key is needed to decrypt the content.
181 // |media_log| Used to report content and engine debug messages. 178 // |media_log| Used to report content and engine debug messages.
182 // |splice_frames_enabled| Indicates that it's okay to generate splice frames
183 // per the MSE specification. Renderers must understand DecoderBuffer's
184 // splice_timestamp() field.
185 ChunkDemuxer(const base::Closure& open_cb, 179 ChunkDemuxer(const base::Closure& open_cb,
186 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 180 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
187 const scoped_refptr<MediaLog>& media_log, 181 const scoped_refptr<MediaLog>& media_log);
188 bool splice_frames_enabled);
189 ~ChunkDemuxer() override; 182 ~ChunkDemuxer() override;
190 183
191 // Demuxer implementation. 184 // Demuxer implementation.
192 std::string GetDisplayName() const override; 185 std::string GetDisplayName() const override;
193 186
194 // |enable_text| Process inband text tracks in the normal way when true, 187 // |enable_text| Process inband text tracks in the normal way when true,
195 // otherwise ignore them. 188 // otherwise ignore them.
196 void Initialize(DemuxerHost* host, 189 void Initialize(DemuxerHost* host,
197 const PipelineStatusCB& init_cb, 190 const PipelineStatusCB& init_cb,
198 bool enable_text_tracks) override; 191 bool enable_text_tracks) override;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 430
438 std::map<std::string, std::unique_ptr<SourceBufferState>> source_state_map_; 431 std::map<std::string, std::unique_ptr<SourceBufferState>> source_state_map_;
439 432
440 std::map<std::string, std::vector<ChunkDemuxerStream*>> id_to_streams_map_; 433 std::map<std::string, std::vector<ChunkDemuxerStream*>> id_to_streams_map_;
441 // Used to hold alive the demuxer streams that were created for removed / 434 // Used to hold alive the demuxer streams that were created for removed /
442 // released SourceBufferState objects. Demuxer clients might still have 435 // released SourceBufferState objects. Demuxer clients might still have
443 // references to these streams, so we need to keep them alive. But they'll be 436 // references to these streams, so we need to keep them alive. But they'll be
444 // in a shut down state, so reading from them will return EOS. 437 // in a shut down state, so reading from them will return EOS.
445 std::vector<std::unique_ptr<ChunkDemuxerStream>> removed_streams_; 438 std::vector<std::unique_ptr<ChunkDemuxerStream>> removed_streams_;
446 439
447 // Indicates that splice frame generation is enabled.
448 const bool splice_frames_enabled_;
449
450 // Accumulate, by type, detected track counts across the SourceBuffers. 440 // Accumulate, by type, detected track counts across the SourceBuffers.
451 int detected_audio_track_count_; 441 int detected_audio_track_count_;
452 int detected_video_track_count_; 442 int detected_video_track_count_;
453 int detected_text_track_count_; 443 int detected_text_track_count_;
454 444
455 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_; 445 std::map<MediaTrack::Id, DemuxerStream*> track_id_to_demux_stream_map_;
456 446
457 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 447 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
458 }; 448 };
459 449
460 } // namespace media 450 } // namespace media
461 451
462 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 452 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/blink/webmediaplayer_impl.cc ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698