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

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

Issue 2085012: Reporting a more accurate buffered time for the video tag (Closed)
Patch Set: Added checks to fix some edgecase bugs. Created 10 years, 6 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/pipeline.h ('k') | media/base/pipeline_impl.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Implementation of Pipeline. 5 // Implementation of Pipeline.
6 6
7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_ 7 #ifndef MEDIA_BASE_PIPELINE_IMPL_H_
8 #define MEDIA_BASE_PIPELINE_IMPL_H_ 8 #define MEDIA_BASE_PIPELINE_IMPL_H_
9 9
10 #include <set> 10 #include <set>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback); 72 virtual void Seek(base::TimeDelta time, PipelineCallback* seek_callback);
73 virtual bool IsRunning() const; 73 virtual bool IsRunning() const;
74 virtual bool IsInitialized() const; 74 virtual bool IsInitialized() const;
75 virtual bool IsNetworkActive() const; 75 virtual bool IsNetworkActive() const;
76 virtual bool IsRendered(const std::string& major_mime_type) const; 76 virtual bool IsRendered(const std::string& major_mime_type) const;
77 virtual float GetPlaybackRate() const; 77 virtual float GetPlaybackRate() const;
78 virtual void SetPlaybackRate(float playback_rate); 78 virtual void SetPlaybackRate(float playback_rate);
79 virtual float GetVolume() const; 79 virtual float GetVolume() const;
80 virtual void SetVolume(float volume); 80 virtual void SetVolume(float volume);
81 virtual base::TimeDelta GetCurrentTime() const; 81 virtual base::TimeDelta GetCurrentTime() const;
82 virtual base::TimeDelta GetBufferedTime() const; 82 virtual base::TimeDelta GetBufferedTime();
83 virtual base::TimeDelta GetMediaDuration() const; 83 virtual base::TimeDelta GetMediaDuration() const;
84 virtual int64 GetBufferedBytes() const; 84 virtual int64 GetBufferedBytes() const;
85 virtual int64 GetTotalBytes() const; 85 virtual int64 GetTotalBytes() const;
86 virtual void GetVideoSize(size_t* width_out, size_t* height_out) const; 86 virtual void GetVideoSize(size_t* width_out, size_t* height_out) const;
87 virtual bool IsStreaming() const; 87 virtual bool IsStreaming() const;
88 virtual bool IsLoaded() const; 88 virtual bool IsLoaded() const;
89 virtual PipelineError GetError() const; 89 virtual PipelineError GetError() const;
90 90
91 // Sets a permanent callback owned by the pipeline that will be executed when 91 // Sets a permanent callback owned by the pipeline that will be executed when
92 // the media reaches the end. 92 // the media reaches the end.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 virtual void SetDuration(base::TimeDelta duration); 146 virtual void SetDuration(base::TimeDelta duration);
147 virtual void SetBufferedTime(base::TimeDelta buffered_time); 147 virtual void SetBufferedTime(base::TimeDelta buffered_time);
148 virtual void SetTotalBytes(int64 total_bytes); 148 virtual void SetTotalBytes(int64 total_bytes);
149 virtual void SetBufferedBytes(int64 buffered_bytes); 149 virtual void SetBufferedBytes(int64 buffered_bytes);
150 virtual void SetVideoSize(size_t width, size_t height); 150 virtual void SetVideoSize(size_t width, size_t height);
151 virtual void SetStreaming(bool streamed); 151 virtual void SetStreaming(bool streamed);
152 virtual void SetLoaded(bool loaded); 152 virtual void SetLoaded(bool loaded);
153 virtual void SetNetworkActivity(bool network_activity); 153 virtual void SetNetworkActivity(bool network_activity);
154 virtual void NotifyEnded(); 154 virtual void NotifyEnded();
155 virtual void DisableAudioRenderer(); 155 virtual void DisableAudioRenderer();
156 virtual void SetCurrentReadPosition(int64 offset);
157 virtual int64 GetCurrentReadPosition();
156 158
157 // Method called during initialization to insert a mime type into the 159 // Method called during initialization to insert a mime type into the
158 // |rendered_mime_types_| set. 160 // |rendered_mime_types_| set.
159 void InsertRenderedMimeType(const std::string& major_mime_type); 161 void InsertRenderedMimeType(const std::string& major_mime_type);
160 162
161 // Method called during initialization to determine if we rendered anything. 163 // Method called during initialization to determine if we rendered anything.
162 bool HasRenderedMimeTypes() const; 164 bool HasRenderedMimeTypes() const;
163 165
164 // Callback executed by filters upon completing initialization. 166 // Callback executed by filters upon completing initialization.
165 void OnFilterInitialize(); 167 void OnFilterInitialize();
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 // For kPausing, kSeeking and kStarting, we need to track how many filters 352 // For kPausing, kSeeking and kStarting, we need to track how many filters
351 // have completed transitioning to the destination state. When 353 // have completed transitioning to the destination state. When
352 // |remaining_transitions_| reaches 0 the pipeline can transition out 354 // |remaining_transitions_| reaches 0 the pipeline can transition out
353 // of the current state. 355 // of the current state.
354 size_t remaining_transitions_; 356 size_t remaining_transitions_;
355 357
356 // For kSeeking we need to remember where we're seeking between filter 358 // For kSeeking we need to remember where we're seeking between filter
357 // replies. 359 // replies.
358 base::TimeDelta seek_timestamp_; 360 base::TimeDelta seek_timestamp_;
359 361
362 // For GetCurrentBytes()/SetCurrentBytes() we need to know what byte we are
363 // currently reading.
364 int64 current_bytes_;
365
366 // Keep track of the maximum buffered position so the buffering appears
367 // smooth.
368 // TODO(vrk): This is a hack.
369 double max_buffered_time_;
370
360 // Filter factory as passed in by Start(). 371 // Filter factory as passed in by Start().
361 scoped_refptr<FilterFactory> filter_factory_; 372 scoped_refptr<FilterFactory> filter_factory_;
362 373
363 // URL for the data source as passed in by Start(). 374 // URL for the data source as passed in by Start().
364 std::string url_; 375 std::string url_;
365 376
366 // Callbacks for various pipeline operations. 377 // Callbacks for various pipeline operations.
367 scoped_ptr<PipelineCallback> seek_callback_; 378 scoped_ptr<PipelineCallback> seek_callback_;
368 scoped_ptr<PipelineCallback> stop_callback_; 379 scoped_ptr<PipelineCallback> stop_callback_;
369 scoped_ptr<PipelineCallback> ended_callback_; 380 scoped_ptr<PipelineCallback> ended_callback_;
(...skipping 11 matching lines...) Expand all
381 // Vector of threads owned by the pipeline and being used by filters. 392 // Vector of threads owned by the pipeline and being used by filters.
382 typedef std::vector<base::Thread*> FilterThreadVector; 393 typedef std::vector<base::Thread*> FilterThreadVector;
383 FilterThreadVector filter_threads_; 394 FilterThreadVector filter_threads_;
384 395
385 DISALLOW_COPY_AND_ASSIGN(PipelineImpl); 396 DISALLOW_COPY_AND_ASSIGN(PipelineImpl);
386 }; 397 };
387 398
388 } // namespace media 399 } // namespace media
389 400
390 #endif // MEDIA_BASE_PIPELINE_IMPL_H_ 401 #endif // MEDIA_BASE_PIPELINE_IMPL_H_
OLDNEW
« no previous file with comments | « media/base/pipeline.h ('k') | media/base/pipeline_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698