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

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

Issue 2343543002: MSE: Replace crossfade splicing overlap trimming. (Closed)
Patch Set: Created 4 years, 3 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
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 15 matching lines...) Expand all
26 #include "media/filters/source_buffer_stream.h" 26 #include "media/filters/source_buffer_stream.h"
27 27
28 namespace media { 28 namespace media {
29 29
30 class FFmpegURLProtocol; 30 class FFmpegURLProtocol;
31 31
32 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream { 32 class MEDIA_EXPORT ChunkDemuxerStream : public DemuxerStream {
33 public: 33 public:
34 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue; 34 typedef std::deque<scoped_refptr<StreamParserBuffer> > BufferQueue;
35 35
36 ChunkDemuxerStream(Type type, 36 ChunkDemuxerStream(Type type, MediaTrack::Id media_track_id);
37 bool splice_frames_enabled,
38 MediaTrack::Id media_track_id);
39 ~ChunkDemuxerStream() override; 37 ~ChunkDemuxerStream() override;
40 38
41 // ChunkDemuxerStream control methods. 39 // ChunkDemuxerStream control methods.
42 void StartReturningData(); 40 void StartReturningData();
43 void AbortReads(); 41 void AbortReads();
44 void CompletePendingReadIfPossible(); 42 void CompletePendingReadIfPossible();
45 void Shutdown(); 43 void Shutdown();
46 44
47 // SourceBufferStream manipulation methods. 45 // SourceBufferStream manipulation methods.
48 void Seek(base::TimeDelta time); 46 void Seek(base::TimeDelta time);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 146
149 Liveness liveness_; 147 Liveness liveness_;
150 148
151 std::unique_ptr<SourceBufferStream> stream_; 149 std::unique_ptr<SourceBufferStream> stream_;
152 150
153 const MediaTrack::Id media_track_id_; 151 const MediaTrack::Id media_track_id_;
154 152
155 mutable base::Lock lock_; 153 mutable base::Lock lock_;
156 State state_; 154 State state_;
157 ReadCB read_cb_; 155 ReadCB read_cb_;
158 bool splice_frames_enabled_;
159 bool partial_append_window_trimming_enabled_; 156 bool partial_append_window_trimming_enabled_;
160 bool is_enabled_; 157 bool is_enabled_;
161 StreamStatusChangeCB stream_status_change_cb_; 158 StreamStatusChangeCB stream_status_change_cb_;
162 159
163 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream); 160 DISALLOW_IMPLICIT_CONSTRUCTORS(ChunkDemuxerStream);
164 }; 161 };
165 162
166 // Demuxer implementation that allows chunks of media data to be passed 163 // Demuxer implementation that allows chunks of media data to be passed
167 // from JavaScript to the media stack. 164 // from JavaScript to the media stack.
168 class MEDIA_EXPORT ChunkDemuxer : public Demuxer { 165 class MEDIA_EXPORT ChunkDemuxer : public Demuxer {
169 public: 166 public:
170 enum Status { 167 enum Status {
171 kOk, // ID added w/o error. 168 kOk, // ID added w/o error.
172 kNotSupported, // Type specified is not supported. 169 kNotSupported, // Type specified is not supported.
173 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs. 170 kReachedIdLimit, // Reached ID limit. We can't handle any more IDs.
174 }; 171 };
175 172
176 // |open_cb| Run when Initialize() is called to signal that the demuxer 173 // |open_cb| Run when Initialize() is called to signal that the demuxer
177 // is ready to receive media data via AppenData(). 174 // is ready to receive media data via AppenData().
178 // |encrypted_media_init_data_cb| Run when the demuxer determines that an 175 // |encrypted_media_init_data_cb| Run when the demuxer determines that an
179 // encryption key is needed to decrypt the content. 176 // encryption key is needed to decrypt the content.
180 // |media_log| Used to report content and engine debug messages. 177 // |media_log| Used to report content and engine debug messages.
181 // |splice_frames_enabled| Indicates that it's okay to generate splice frames
182 // per the MSE specification. Renderers must understand DecoderBuffer's
183 // splice_timestamp() field.
184 ChunkDemuxer(const base::Closure& open_cb, 178 ChunkDemuxer(const base::Closure& open_cb,
185 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 179 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
186 const scoped_refptr<MediaLog>& media_log, 180 const scoped_refptr<MediaLog>& media_log);
187 bool splice_frames_enabled);
188 ~ChunkDemuxer() override; 181 ~ChunkDemuxer() override;
189 182
190 // Demuxer implementation. 183 // Demuxer implementation.
191 std::string GetDisplayName() const override; 184 std::string GetDisplayName() const override;
192 185
193 // |enable_text| Process inband text tracks in the normal way when true, 186 // |enable_text| Process inband text tracks in the normal way when true,
194 // otherwise ignore them. 187 // otherwise ignore them.
195 void Initialize(DemuxerHost* host, 188 void Initialize(DemuxerHost* host,
196 const PipelineStatusCB& cb, 189 const PipelineStatusCB& cb,
197 bool enable_text_tracks) override; 190 bool enable_text_tracks) override;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 422
430 typedef std::map<std::string, MediaSourceState*> MediaSourceStateMap; 423 typedef std::map<std::string, MediaSourceState*> MediaSourceStateMap;
431 MediaSourceStateMap source_state_map_; 424 MediaSourceStateMap source_state_map_;
432 425
433 // Used to ensure that (1) config data matches the type and codec provided in 426 // Used to ensure that (1) config data matches the type and codec provided in
434 // AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be 427 // AddId(), (2) only 1 audio and 1 video sources are added, and (3) ids may be
435 // removed with RemoveID() but can not be re-added (yet). 428 // removed with RemoveID() but can not be re-added (yet).
436 std::string source_id_audio_; 429 std::string source_id_audio_;
437 std::string source_id_video_; 430 std::string source_id_video_;
438 431
439 // Indicates that splice frame generation is enabled.
440 const bool splice_frames_enabled_;
441
442 // Accumulate, by type, detected track counts across the SourceBuffers. 432 // Accumulate, by type, detected track counts across the SourceBuffers.
443 int detected_audio_track_count_; 433 int detected_audio_track_count_;
444 int detected_video_track_count_; 434 int detected_video_track_count_;
445 int detected_text_track_count_; 435 int detected_text_track_count_;
446 436
447 std::map<MediaTrack::Id, const DemuxerStream*> track_id_to_demux_stream_map_; 437 std::map<MediaTrack::Id, const DemuxerStream*> track_id_to_demux_stream_map_;
448 438
449 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 439 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
450 }; 440 };
451 441
452 } // namespace media 442 } // namespace media
453 443
454 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 444 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698