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

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

Issue 794343003: Implement evictFrames() to support MSE's coded frame eviction algorithm. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated existing SourceBufferStream unittests Created 6 years 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/websourcebuffer_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 <deque> 8 #include <deque>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // Removes buffers between |start| and |end| according to the steps 49 // Removes buffers between |start| and |end| according to the steps
50 // in the "Coded Frame Removal Algorithm" in the Media Source 50 // in the "Coded Frame Removal Algorithm" in the Media Source
51 // Extensions Spec. 51 // Extensions Spec.
52 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc e.html#sourcebuffer-coded-frame-removal 52 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sourc e.html#sourcebuffer-coded-frame-removal
53 // 53 //
54 // |duration| is the current duration of the presentation. It is 54 // |duration| is the current duration of the presentation. It is
55 // required by the computation outlined in the spec. 55 // required by the computation outlined in the spec.
56 void Remove(base::TimeDelta start, base::TimeDelta end, 56 void Remove(base::TimeDelta start, base::TimeDelta end,
57 base::TimeDelta duration); 57 base::TimeDelta duration);
58 58
59 // If the buffer is full, runs Frame Removal to try to free up space, as
60 // specified in the "Coded Frame Eviction Algorithm" in the Media Source
61 // Extensions Spec. Returns false iff buffer is still full after running
62 // eviction
63 // https://w3c.github.io/media-source/#sourcebuffer-coded-frame-eviction
64 bool EvictFrames(DecodeTimestamp media_time);
65
59 // Signal to the stream that duration has changed to |duration|. 66 // Signal to the stream that duration has changed to |duration|.
60 void OnSetDuration(base::TimeDelta duration); 67 void OnSetDuration(base::TimeDelta duration);
61 68
62 // Returns the range of buffered data in this stream, capped at |duration|. 69 // Returns the range of buffered data in this stream, capped at |duration|.
63 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const; 70 Ranges<base::TimeDelta> GetBufferedRanges(base::TimeDelta duration) const;
64 71
65 // Returns the duration of the buffered data. 72 // Returns the duration of the buffered data.
66 // Returns base::TimeDelta() if the stream has no buffered data. 73 // Returns base::TimeDelta() if the stream has no buffered data.
67 base::TimeDelta GetBufferedDuration() const; 74 base::TimeDelta GetBufferedDuration() const;
68 75
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // |splice_frames_enabled| Indicates that it's okay to generate splice frames 163 // |splice_frames_enabled| Indicates that it's okay to generate splice frames
157 // per the MSE specification. Renderers must understand DecoderBuffer's 164 // per the MSE specification. Renderers must understand DecoderBuffer's
158 // splice_timestamp() field. 165 // splice_timestamp() field.
159 ChunkDemuxer(const base::Closure& open_cb, 166 ChunkDemuxer(const base::Closure& open_cb,
160 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, 167 const EncryptedMediaInitDataCB& encrypted_media_init_data_cb,
161 const LogCB& log_cb, 168 const LogCB& log_cb,
162 const scoped_refptr<MediaLog>& media_log, 169 const scoped_refptr<MediaLog>& media_log,
163 bool splice_frames_enabled); 170 bool splice_frames_enabled);
164 ~ChunkDemuxer() override; 171 ~ChunkDemuxer() override;
165 172
173 // Set the media time provider.
174 // TODO(damienv): should truly be part of the constructor.
175 void SetMediaTimeProvider(
176 const base::Callback<base::TimeDelta(void)>& get_media_time_cb);
177
166 // Demuxer implementation. 178 // Demuxer implementation.
167 void Initialize(DemuxerHost* host, 179 void Initialize(DemuxerHost* host,
168 const PipelineStatusCB& cb, 180 const PipelineStatusCB& cb,
169 bool enable_text_tracks) override; 181 bool enable_text_tracks) override;
170 void Stop() override; 182 void Stop() override;
171 void Seek(base::TimeDelta time, const PipelineStatusCB& cb) override; 183 void Seek(base::TimeDelta time, const PipelineStatusCB& cb) override;
172 base::Time GetTimelineOffset() const override; 184 base::Time GetTimelineOffset() const override;
173 DemuxerStream* GetStream(DemuxerStream::Type type) override; 185 DemuxerStream* GetStream(DemuxerStream::Type type) override;
174 base::TimeDelta GetStartTime() const override; 186 base::TimeDelta GetStartTime() const override;
175 187
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void Abort(const std::string& id, 247 void Abort(const std::string& id,
236 base::TimeDelta append_window_start, 248 base::TimeDelta append_window_start,
237 base::TimeDelta append_window_end, 249 base::TimeDelta append_window_end,
238 base::TimeDelta* timestamp_offset); 250 base::TimeDelta* timestamp_offset);
239 251
240 // Remove buffers between |start| and |end| for the source buffer 252 // Remove buffers between |start| and |end| for the source buffer
241 // associated with |id|. 253 // associated with |id|.
242 void Remove(const std::string& id, base::TimeDelta start, 254 void Remove(const std::string& id, base::TimeDelta start,
243 base::TimeDelta end); 255 base::TimeDelta end);
244 256
257 bool EvictFrames();
258
245 // Returns the current presentation duration. 259 // Returns the current presentation duration.
246 double GetDuration(); 260 double GetDuration();
247 double GetDuration_Locked(); 261 double GetDuration_Locked();
248 262
249 // Notifies the demuxer that the duration of the media has changed to 263 // Notifies the demuxer that the duration of the media has changed to
250 // |duration|. 264 // |duration|.
251 void SetDuration(double duration); 265 void SetDuration(double duration);
252 266
253 // Returns true if the source buffer associated with |id| is currently parsing 267 // Returns true if the source buffer associated with |id| is currently parsing
254 // a media segment, or false otherwise. 268 // a media segment, or false otherwise.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 PipelineStatusCB init_cb_; 383 PipelineStatusCB init_cb_;
370 // Callback to execute upon seek completion. 384 // Callback to execute upon seek completion.
371 // TODO(wolenetz/acolwell): Protect against possible double-locking by first 385 // TODO(wolenetz/acolwell): Protect against possible double-locking by first
372 // releasing |lock_| before executing this callback. See 386 // releasing |lock_| before executing this callback. See
373 // http://crbug.com/308226 387 // http://crbug.com/308226
374 PipelineStatusCB seek_cb_; 388 PipelineStatusCB seek_cb_;
375 389
376 scoped_ptr<ChunkDemuxerStream> audio_; 390 scoped_ptr<ChunkDemuxerStream> audio_;
377 scoped_ptr<ChunkDemuxerStream> video_; 391 scoped_ptr<ChunkDemuxerStream> video_;
378 392
393 base::Callback<base::TimeDelta(void)> get_media_time_cb_;
394
379 base::TimeDelta duration_; 395 base::TimeDelta duration_;
380 396
381 // The duration passed to the last SetDuration(). If 397 // The duration passed to the last SetDuration(). If
382 // SetDuration() is never called or an AppendData() call or 398 // SetDuration() is never called or an AppendData() call or
383 // a EndOfStream() call changes |duration_|, then this 399 // a EndOfStream() call changes |duration_|, then this
384 // variable is set to < 0 to indicate that the |duration_| represents 400 // variable is set to < 0 to indicate that the |duration_| represents
385 // the actual duration instead of a user specified value. 401 // the actual duration instead of a user specified value.
386 double user_specified_duration_; 402 double user_specified_duration_;
387 403
388 base::Time timeline_offset_; 404 base::Time timeline_offset_;
(...skipping 10 matching lines...) Expand all
399 415
400 // Indicates that splice frame generation is enabled. 416 // Indicates that splice frame generation is enabled.
401 const bool splice_frames_enabled_; 417 const bool splice_frames_enabled_;
402 418
403 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer); 419 DISALLOW_COPY_AND_ASSIGN(ChunkDemuxer);
404 }; 420 };
405 421
406 } // namespace media 422 } // namespace media
407 423
408 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_ 424 #endif // MEDIA_FILTERS_CHUNK_DEMUXER_H_
OLDNEW
« no previous file with comments | « media/blink/websourcebuffer_impl.cc ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698