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

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

Issue 534073002: Switch to using media::TimeSource inside media::RendererImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad rebase Created 6 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
« no previous file with comments | « no previous file | media/base/mock_filters.h » ('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_AUDIO_RENDERER_H_ 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_H_
6 #define MEDIA_BASE_AUDIO_RENDERER_H_ 6 #define MEDIA_BASE_AUDIO_RENDERER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/base/buffering_state.h" 10 #include "media/base/buffering_state.h"
11 #include "media/base/media_export.h" 11 #include "media/base/media_export.h"
12 #include "media/base/pipeline_status.h" 12 #include "media/base/pipeline_status.h"
13 13
14 namespace media { 14 namespace media {
15 15
16 class DemuxerStream; 16 class DemuxerStream;
17 class TimeSource; 17 class TimeSource;
18 18
19 class MEDIA_EXPORT AudioRenderer { 19 class MEDIA_EXPORT AudioRenderer {
20 public: 20 public:
21 // First parameter is the current time that has been rendered.
22 // Second parameter is the maximum time value that the clock cannot exceed.
23 typedef base::Callback<void(base::TimeDelta, base::TimeDelta)> TimeCB;
24
25 AudioRenderer(); 21 AudioRenderer();
26 22
27 // Stop all operations and fire all pending callbacks. 23 // Stop all operations and fire all pending callbacks.
28 virtual ~AudioRenderer(); 24 virtual ~AudioRenderer();
29 25
30 // Initialize an AudioRenderer with |stream|, executing |init_cb| upon 26 // Initialize an AudioRenderer with |stream|, executing |init_cb| upon
31 // completion. 27 // completion.
32 // 28 //
33 // |statistics_cb| is executed periodically with audio rendering stats. 29 // |statistics_cb| is executed periodically with audio rendering stats.
34 // 30 //
35 // |time_cb| is executed whenever time has advanced by way of audio rendering.
36 //
37 // |buffering_state_cb| is executed when audio rendering has either run out of 31 // |buffering_state_cb| is executed when audio rendering has either run out of
38 // data or has enough data to continue playback. 32 // data or has enough data to continue playback.
39 // 33 //
40 // |ended_cb| is executed when audio rendering has reached the end of stream. 34 // |ended_cb| is executed when audio rendering has reached the end of stream.
41 // 35 //
42 // |error_cb| is executed if an error was encountered. 36 // |error_cb| is executed if an error was encountered.
43 virtual void Initialize(DemuxerStream* stream, 37 virtual void Initialize(DemuxerStream* stream,
44 const PipelineStatusCB& init_cb, 38 const PipelineStatusCB& init_cb,
45 const StatisticsCB& statistics_cb, 39 const StatisticsCB& statistics_cb,
46 const TimeCB& time_cb,
47 const BufferingStateCB& buffering_state_cb, 40 const BufferingStateCB& buffering_state_cb,
48 const base::Closure& ended_cb, 41 const base::Closure& ended_cb,
49 const PipelineStatusCB& error_cb) = 0; 42 const PipelineStatusCB& error_cb) = 0;
50 43
51 // Returns the TimeSource associated with audio rendering. 44 // Returns the TimeSource associated with audio rendering.
52 virtual TimeSource* GetTimeSource() = 0; 45 virtual TimeSource* GetTimeSource() = 0;
53 46
54 // Discard any audio data, executing |callback| when completed. 47 // Discard any audio data, executing |callback| when completed.
55 // 48 //
56 // Clients should expect |buffering_state_cb| to be called with 49 // Clients should expect |buffering_state_cb| to be called with
57 // BUFFERING_HAVE_NOTHING while flushing is in progress. 50 // BUFFERING_HAVE_NOTHING while flushing is in progress.
58 virtual void Flush(const base::Closure& callback) = 0; 51 virtual void Flush(const base::Closure& callback) = 0;
59 52
60 // Starts playback by reading from |stream| and decoding and rendering audio. 53 // Starts playback by reading from |stream| and decoding and rendering audio.
61 // 54 //
62 // Only valid to call after a successful Initialize() or Flush(). 55 // Only valid to call after a successful Initialize() or Flush().
63 virtual void StartPlaying() = 0; 56 virtual void StartPlaying() = 0;
64 57
65 // Sets the output volume. 58 // Sets the output volume.
66 virtual void SetVolume(float volume) = 0; 59 virtual void SetVolume(float volume) = 0;
67 60
68 private: 61 private:
69 DISALLOW_COPY_AND_ASSIGN(AudioRenderer); 62 DISALLOW_COPY_AND_ASSIGN(AudioRenderer);
70 }; 63 };
71 64
72 } // namespace media 65 } // namespace media
73 66
74 #endif // MEDIA_BASE_AUDIO_RENDERER_H_ 67 #endif // MEDIA_BASE_AUDIO_RENDERER_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698