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

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

Issue 164403: Implemented end-of-stream callback for media::PipelineImpl. (Closed)
Patch Set: Baz Created 11 years, 4 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/video_frame_impl_unittest.cc ('k') | media/filters/audio_renderer_base.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // AudioRendererBase takes care of the tricky queuing work and provides simple 5 // AudioRendererBase takes care of the tricky queuing work and provides simple
6 // methods for subclasses to peek and poke at audio data. In addition to 6 // methods for subclasses to peek and poke at audio data. In addition to
7 // AudioRenderer interface methods this classes doesn't implement, subclasses 7 // AudioRenderer interface methods this classes doesn't implement, subclasses
8 // must also implement the following methods: 8 // must also implement the following methods:
9 // OnInitialized 9 // OnInitialized
10 // OnStop 10 // OnStop
(...skipping 21 matching lines...) Expand all
32 public: 32 public:
33 // MediaFilter implementation. 33 // MediaFilter implementation.
34 virtual void Play(FilterCallback* callback); 34 virtual void Play(FilterCallback* callback);
35 virtual void Pause(FilterCallback* callback); 35 virtual void Pause(FilterCallback* callback);
36 virtual void Stop(); 36 virtual void Stop();
37 37
38 virtual void Seek(base::TimeDelta time, FilterCallback* callback); 38 virtual void Seek(base::TimeDelta time, FilterCallback* callback);
39 39
40 // AudioRenderer implementation. 40 // AudioRenderer implementation.
41 virtual void Initialize(AudioDecoder* decoder, FilterCallback* callback); 41 virtual void Initialize(AudioDecoder* decoder, FilterCallback* callback);
42 virtual bool HasEnded();
42 43
43 protected: 44 protected:
44 // Only allow a factory to create this class. 45 // Only allow a factory to create this class.
45 AudioRendererBase(); 46 AudioRendererBase();
46 virtual ~AudioRendererBase(); 47 virtual ~AudioRendererBase();
47 48
48 // Called by Initialize(). |media_format| is the format of the AudioDecoder. 49 // Called by Initialize(). |media_format| is the format of the AudioDecoder.
49 // Subclasses should return true if they were able to initialize, false 50 // Subclasses should return true if they were able to initialize, false
50 // otherwise. 51 // otherwise.
51 virtual bool OnInitialize(const MediaFormat& media_format) = 0; 52 virtual bool OnInitialize(const MediaFormat& media_format) = 0;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 enum State { 109 enum State {
109 kUninitialized, 110 kUninitialized,
110 kPaused, 111 kPaused,
111 kSeeking, 112 kSeeking,
112 kPlaying, 113 kPlaying,
113 kStopped, 114 kStopped,
114 kError, 115 kError,
115 }; 116 };
116 State state_; 117 State state_;
117 118
119 // Keeps track of whether we received and rendered the end of stream buffer.
120 bool recieved_end_of_stream_;
121 bool rendered_end_of_stream_;
122
118 // Keeps track of our pending reads. We *must* have no pending reads before 123 // Keeps track of our pending reads. We *must* have no pending reads before
119 // executing the pause callback, otherwise we breach the contract that all 124 // executing the pause callback, otherwise we breach the contract that all
120 // filters are idling. 125 // filters are idling.
121 // 126 //
122 // We use size_t since we compare against std::deque::size(). 127 // We use size_t since we compare against std::deque::size().
123 size_t pending_reads_; 128 size_t pending_reads_;
124 129
125 // Audio time at end of last call to FillBuffer(). 130 // Audio time at end of last call to FillBuffer().
126 // TODO(ralphl): Update this value after seeking. 131 // TODO(ralphl): Update this value after seeking.
127 base::TimeDelta last_fill_buffer_time_; 132 base::TimeDelta last_fill_buffer_time_;
128 133
129 // Filter callbacks. 134 // Filter callbacks.
130 scoped_ptr<FilterCallback> pause_callback_; 135 scoped_ptr<FilterCallback> pause_callback_;
131 scoped_ptr<FilterCallback> seek_callback_; 136 scoped_ptr<FilterCallback> seek_callback_;
132 137
133 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase); 138 DISALLOW_COPY_AND_ASSIGN(AudioRendererBase);
134 }; 139 };
135 140
136 } // namespace media 141 } // namespace media
137 142
138 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_ 143 #endif // MEDIA_FILTERS_AUDIO_RENDERER_BASE_H_
OLDNEW
« no previous file with comments | « media/base/video_frame_impl_unittest.cc ('k') | media/filters/audio_renderer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698