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

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

Issue 2605473002: Fix processing of multiple stream status changes by renderer (Closed)
Patch Set: Use a queue of postponed notifications + CR feedback 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') | media/renderers/renderer_impl.cc » ('J')
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 <memory> 8 #include <memory>
9 #include <queue>
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"
18 #include "base/time/time.h" 19 #include "base/time/time.h"
(...skipping 34 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 base::CancelableClosure deferred_video_underflow_cb_; 190 base::CancelableClosure deferred_video_underflow_cb_;
190 191
191 // Used to defer underflow for audio when restarting audio playback. 192 // Used to defer underflow for audio when restarting audio playback.
192 base::CancelableClosure deferred_audio_restart_underflow_cb_; 193 base::CancelableClosure deferred_audio_restart_underflow_cb_;
193 194
194 // The amount of time to wait before declaring underflow if the video renderer 195 // 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. 196 // runs out of data but the audio renderer still has enough.
196 base::TimeDelta video_underflow_threshold_; 197 base::TimeDelta video_underflow_threshold_;
197 198
198 bool restarting_audio_ = false; 199 bool restarting_audio_ = false;
200 std::queue<base::Closure> postponed_audio_status_notifications_;
xhwang 2017/01/04 22:04:16 tiny nit: - typically we use "pending" instead of
servolk 2017/01/05 02:38:45 Done.
199 bool restarting_video_ = false; 201 bool restarting_video_ = false;
202 std::queue<base::Closure> postponed_video_status_notifications_;
200 203
201 base::WeakPtr<RendererImpl> weak_this_; 204 base::WeakPtr<RendererImpl> weak_this_;
202 base::WeakPtrFactory<RendererImpl> weak_factory_; 205 base::WeakPtrFactory<RendererImpl> weak_factory_;
203 206
204 DISALLOW_COPY_AND_ASSIGN(RendererImpl); 207 DISALLOW_COPY_AND_ASSIGN(RendererImpl);
205 }; 208 };
206 209
207 } // namespace media 210 } // namespace media
208 211
209 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_ 212 #endif // MEDIA_RENDERERS_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | media/renderers/renderer_impl.cc » ('j') | media/renderers/renderer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698