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

Side by Side Diff: media/base/pipeline.h

Issue 224093011: Move DataSourceHost to BufferedDataSourceHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows release build. Created 6 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/base/mock_data_source_host.cc ('k') | media/base/pipeline.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_BASE_PIPELINE_H_ 5 #ifndef MEDIA_BASE_PIPELINE_H_
6 #define MEDIA_BASE_PIPELINE_H_ 6 #define MEDIA_BASE_PIPELINE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Initialization is a series of state transitions from "Created" through each 69 // Initialization is a series of state transitions from "Created" through each
70 // filter initialization state. When all filter initialization states have 70 // filter initialization state. When all filter initialization states have
71 // completed, we are implicitly in a "Paused" state. At that point we simulate 71 // completed, we are implicitly in a "Paused" state. At that point we simulate
72 // a Seek() to the beginning of the media to give filters a chance to preroll. 72 // a Seek() to the beginning of the media to give filters a chance to preroll.
73 // From then on the normal Seek() transitions are carried out and we start 73 // From then on the normal Seek() transitions are carried out and we start
74 // playing the media. 74 // playing the media.
75 // 75 //
76 // If any error ever happens, this object will transition to the "Error" state 76 // If any error ever happens, this object will transition to the "Error" state
77 // from any state. If Stop() is ever called, this object will transition to 77 // from any state. If Stop() is ever called, this object will transition to
78 // "Stopped" state. 78 // "Stopped" state.
79 class MEDIA_EXPORT Pipeline : public DataSourceHost, public DemuxerHost { 79 class MEDIA_EXPORT Pipeline : public DemuxerHost {
80 public: 80 public:
81 // Constructs a media pipeline that will execute on |task_runner|. 81 // Constructs a media pipeline that will execute on |task_runner|.
82 Pipeline(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 82 Pipeline(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
83 MediaLog* media_log); 83 MediaLog* media_log);
84 virtual ~Pipeline(); 84 virtual ~Pipeline();
85 85
86 // Build a pipeline to using the given filter collection to construct a filter 86 // Build a pipeline to using the given filter collection to construct a filter
87 // chain, executing |seek_cb| when the initial seek/preroll has completed. 87 // chain, executing |seek_cb| when the initial seek/preroll has completed.
88 // 88 //
89 // |filter_collection| must be a complete collection containing a demuxer, 89 // |filter_collection| must be a complete collection containing a demuxer,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // GetMediaDuration(). 162 // GetMediaDuration().
163 base::TimeDelta GetMediaTime() const; 163 base::TimeDelta GetMediaTime() const;
164 164
165 // Get approximate time ranges of buffered media. 165 // Get approximate time ranges of buffered media.
166 Ranges<base::TimeDelta> GetBufferedTimeRanges(); 166 Ranges<base::TimeDelta> GetBufferedTimeRanges();
167 167
168 // Get the duration of the media in microseconds. If the duration has not 168 // Get the duration of the media in microseconds. If the duration has not
169 // been determined yet, then returns 0. 169 // been determined yet, then returns 0.
170 base::TimeDelta GetMediaDuration() const; 170 base::TimeDelta GetMediaDuration() const;
171 171
172 // Get the total size of the media file. If the size has not yet been
173 // determined or can not be determined, this value is 0.
174 int64 GetTotalBytes() const;
175
176 // Return true if loading progress has been made since the last time this 172 // Return true if loading progress has been made since the last time this
177 // method was called. 173 // method was called.
178 bool DidLoadingProgress() const; 174 bool DidLoadingProgress() const;
179 175
180 // Gets the current pipeline statistics. 176 // Gets the current pipeline statistics.
181 PipelineStatistics GetStatistics() const; 177 PipelineStatistics GetStatistics() const;
182 178
183 void SetClockForTesting(Clock* clock); 179 void SetClockForTesting(Clock* clock);
184 void SetErrorForTesting(PipelineStatus status); 180 void SetErrorForTesting(PipelineStatus status);
185 181
(...skipping 22 matching lines...) Expand all
208 // Updates |state_|. All state transitions should use this call. 204 // Updates |state_|. All state transitions should use this call.
209 void SetState(State next_state); 205 void SetState(State next_state);
210 206
211 static const char* GetStateString(State state); 207 static const char* GetStateString(State state);
212 State GetNextState() const; 208 State GetNextState() const;
213 209
214 // Helper method that runs & resets |seek_cb_| and resets |seek_timestamp_| 210 // Helper method that runs & resets |seek_cb_| and resets |seek_timestamp_|
215 // and |seek_pending_|. 211 // and |seek_pending_|.
216 void FinishSeek(); 212 void FinishSeek();
217 213
218 // DataSourceHost (by way of DemuxerHost) implementation. 214 // DemuxerHost implementaion.
219 virtual void SetTotalBytes(int64 total_bytes) OVERRIDE;
220 virtual void AddBufferedByteRange(int64 start, int64 end) OVERRIDE;
221 virtual void AddBufferedTimeRange(base::TimeDelta start, 215 virtual void AddBufferedTimeRange(base::TimeDelta start,
222 base::TimeDelta end) OVERRIDE; 216 base::TimeDelta end) OVERRIDE;
223
224 // DemuxerHost implementaion.
225 virtual void SetDuration(base::TimeDelta duration) OVERRIDE; 217 virtual void SetDuration(base::TimeDelta duration) OVERRIDE;
226 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE; 218 virtual void OnDemuxerError(PipelineStatus error) OVERRIDE;
227 virtual void AddTextStream(DemuxerStream* text_stream, 219 virtual void AddTextStream(DemuxerStream* text_stream,
228 const TextTrackConfig& config) OVERRIDE; 220 const TextTrackConfig& config) OVERRIDE;
229 virtual void RemoveTextStream(DemuxerStream* text_stream) OVERRIDE; 221 virtual void RemoveTextStream(DemuxerStream* text_stream) OVERRIDE;
230 222
231 // Initiates teardown sequence in response to a runtime error. 223 // Initiates teardown sequence in response to a runtime error.
232 // 224 //
233 // Safe to call from any thread. 225 // Safe to call from any thread.
234 void SetError(PipelineStatus error); 226 void SetError(PipelineStatus error);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 330
339 // MediaLog to which to log events. 331 // MediaLog to which to log events.
340 scoped_refptr<MediaLog> media_log_; 332 scoped_refptr<MediaLog> media_log_;
341 333
342 // Lock used to serialize access for the following data members. 334 // Lock used to serialize access for the following data members.
343 mutable base::Lock lock_; 335 mutable base::Lock lock_;
344 336
345 // Whether or not the pipeline is running. 337 // Whether or not the pipeline is running.
346 bool running_; 338 bool running_;
347 339
348 // Amount of available buffered data. Set by filters. 340 // Amount of available buffered data as reported by |demuxer_|.
349 Ranges<int64> buffered_byte_ranges_;
350 Ranges<base::TimeDelta> buffered_time_ranges_; 341 Ranges<base::TimeDelta> buffered_time_ranges_;
351 342
352 // True when AddBufferedByteRange() has been called more recently than 343 // True when AddBufferedTimeRange() has been called more recently than
353 // DidLoadingProgress(). 344 // DidLoadingProgress().
354 mutable bool did_loading_progress_; 345 mutable bool did_loading_progress_;
355 346
356 // Total size of the media. Set by filters.
357 int64 total_bytes_;
358
359 // Current volume level (from 0.0f to 1.0f). This value is set immediately 347 // Current volume level (from 0.0f to 1.0f). This value is set immediately
360 // via SetVolume() and a task is dispatched on the task runner to notify the 348 // via SetVolume() and a task is dispatched on the task runner to notify the
361 // filters. 349 // filters.
362 float volume_; 350 float volume_;
363 351
364 // Current playback rate (>= 0.0f). This value is set immediately via 352 // Current playback rate (>= 0.0f). This value is set immediately via
365 // SetPlaybackRate() and a task is dispatched on the task runner to notify 353 // SetPlaybackRate() and a task is dispatched on the task runner to notify
366 // the filters. 354 // the filters.
367 float playback_rate_; 355 float playback_rate_;
368 356
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 scoped_ptr<SerialRunner> pending_callbacks_; 421 scoped_ptr<SerialRunner> pending_callbacks_;
434 422
435 base::ThreadChecker thread_checker_; 423 base::ThreadChecker thread_checker_;
436 424
437 DISALLOW_COPY_AND_ASSIGN(Pipeline); 425 DISALLOW_COPY_AND_ASSIGN(Pipeline);
438 }; 426 };
439 427
440 } // namespace media 428 } // namespace media
441 429
442 #endif // MEDIA_BASE_PIPELINE_H_ 430 #endif // MEDIA_BASE_PIPELINE_H_
OLDNEW
« no previous file with comments | « media/base/mock_data_source_host.cc ('k') | media/base/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698