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

Side by Side Diff: media/renderers/renderer_impl.h

Issue 2605473002: Fix processing of multiple stream status changes by renderer (Closed)
Patch Set: CR feedback (use a single unified notification queue) Created 3 years, 11 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/renderers/renderer_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RENDERERS_RENDERER_IMPL_H_ 5 #ifndef MEDIA_RENDERERS_RENDERER_IMPL_H_
6 #define MEDIA_RENDERERS_RENDERER_IMPL_H_ 6 #define MEDIA_RENDERERS_RENDERER_IMPL_H_
7 7
8 #include <list>
8 #include <memory> 9 #include <memory>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/cancelable_callback.h" 12 #include "base/cancelable_callback.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/synchronization/lock.h" 16 #include "base/synchronization/lock.h"
16 #include "base/time/clock.h" 17 #include "base/time/clock.h"
17 #include "base/time/default_tick_clock.h" 18 #include "base/time/default_tick_clock.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 RendererClient* client, 54 RendererClient* client,
54 const PipelineStatusCB& init_cb) final; 55 const PipelineStatusCB& init_cb) final;
55 void SetCdm(CdmContext* cdm_context, 56 void SetCdm(CdmContext* cdm_context,
56 const CdmAttachedCB& cdm_attached_cb) final; 57 const CdmAttachedCB& cdm_attached_cb) final;
57 void Flush(const base::Closure& flush_cb) final; 58 void Flush(const base::Closure& flush_cb) final;
58 void StartPlayingFrom(base::TimeDelta time) final; 59 void StartPlayingFrom(base::TimeDelta time) final;
59 void SetPlaybackRate(double playback_rate) final; 60 void SetPlaybackRate(double playback_rate) final;
60 void SetVolume(float volume) final; 61 void SetVolume(float volume) final;
61 base::TimeDelta GetMediaTime() final; 62 base::TimeDelta GetMediaTime() final;
62 63
63 void RestartStreamPlayback(DemuxerStream* stream, 64 void OnStreamStatusChanged(DemuxerStream* stream,
64 bool enabled, 65 bool enabled,
65 base::TimeDelta time); 66 base::TimeDelta time);
66 67
67 // Helper functions for testing purposes. Must be called before Initialize(). 68 // Helper functions for testing purposes. Must be called before Initialize().
68 void DisableUnderflowForTesting(); 69 void DisableUnderflowForTesting();
69 void EnableClocklessVideoPlaybackForTesting(); 70 void EnableClocklessVideoPlaybackForTesting();
70 void set_time_source_for_testing(TimeSource* time_source) { 71 void set_time_source_for_testing(TimeSource* time_source) {
71 time_source_ = time_source; 72 time_source_ = time_source;
72 } 73 }
73 void set_video_underflow_threshold_for_testing(base::TimeDelta threshold) { 74 void set_video_underflow_threshold_for_testing(base::TimeDelta threshold) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void OnRendererEnded(DemuxerStream::Type type); 140 void OnRendererEnded(DemuxerStream::Type type);
140 bool PlaybackHasEnded() const; 141 bool PlaybackHasEnded() const;
141 void RunEndedCallbackIfNeeded(); 142 void RunEndedCallbackIfNeeded();
142 143
143 // Callback executed when a runtime error happens. 144 // Callback executed when a runtime error happens.
144 void OnError(PipelineStatus error); 145 void OnError(PipelineStatus error);
145 void OnWaitingForDecryptionKey(); 146 void OnWaitingForDecryptionKey();
146 void OnVideoNaturalSizeChange(const gfx::Size& size); 147 void OnVideoNaturalSizeChange(const gfx::Size& size);
147 void OnVideoOpacityChange(bool opaque); 148 void OnVideoOpacityChange(bool opaque);
148 149
150 void OnStreamRestartCompleted();
151
149 State state_; 152 State state_;
150 153
151 // Task runner used to execute pipeline tasks. 154 // Task runner used to execute pipeline tasks.
152 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 155 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
153 156
154 DemuxerStreamProvider* demuxer_stream_provider_; 157 DemuxerStreamProvider* demuxer_stream_provider_;
155 RendererClient* client_; 158 RendererClient* client_;
156 159
157 // Temporary callback used for Initialize() and Flush(). 160 // Temporary callback used for Initialize() and Flush().
158 PipelineStatusCB init_cb_; 161 PipelineStatusCB init_cb_;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 193
191 // Used to defer underflow for audio when restarting audio playback. 194 // Used to defer underflow for audio when restarting audio playback.
192 base::CancelableClosure deferred_audio_restart_underflow_cb_; 195 base::CancelableClosure deferred_audio_restart_underflow_cb_;
193 196
194 // The amount of time to wait before declaring underflow if the video renderer 197 // The amount of time to wait before declaring underflow if the video renderer
195 // runs out of data but the audio renderer still has enough. 198 // runs out of data but the audio renderer still has enough.
196 base::TimeDelta video_underflow_threshold_; 199 base::TimeDelta video_underflow_threshold_;
197 200
198 bool restarting_audio_ = false; 201 bool restarting_audio_ = false;
199 bool restarting_video_ = false; 202 bool restarting_video_ = false;
203 std::list<base::Closure> pending_stream_status_notifications_;
200 204
201 base::WeakPtr<RendererImpl> weak_this_; 205 base::WeakPtr<RendererImpl> weak_this_;
202 base::WeakPtrFactory<RendererImpl> weak_factory_; 206 base::WeakPtrFactory<RendererImpl> weak_factory_;
203 207
204 DISALLOW_COPY_AND_ASSIGN(RendererImpl); 208 DISALLOW_COPY_AND_ASSIGN(RendererImpl);
205 }; 209 };
206 210
207 } // namespace media 211 } // namespace media
208 212
209 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ 213 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/renderers/renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698