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

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

Issue 2815303006: Convert MediaLog from being ref counted to owned by WebMediaPlayer. (Closed)
Patch Set: Rebase. Created 3 years, 8 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_impl.h ('k') | media/base/pipeline_impl_unittest.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) 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 #include "media/base/pipeline_impl.h" 5 #include "media/base/pipeline_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 30 matching lines...) Expand all
41 return gfx::Size(natural_size.height(), natural_size.width()); 41 return gfx::Size(natural_size.height(), natural_size.width());
42 return natural_size; 42 return natural_size;
43 } 43 }
44 44
45 } // namespace 45 } // namespace
46 46
47 class PipelineImpl::RendererWrapper : public DemuxerHost, 47 class PipelineImpl::RendererWrapper : public DemuxerHost,
48 public RendererClient { 48 public RendererClient {
49 public: 49 public:
50 RendererWrapper(scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, 50 RendererWrapper(scoped_refptr<base::SingleThreadTaskRunner> media_task_runner,
51 scoped_refptr<MediaLog> media_log); 51 MediaLog* media_log);
52 ~RendererWrapper() final; 52 ~RendererWrapper() final;
53 53
54 void Start(Demuxer* demuxer, 54 void Start(Demuxer* demuxer,
55 std::unique_ptr<Renderer> renderer, 55 std::unique_ptr<Renderer> renderer,
56 std::unique_ptr<TextRenderer> text_renderer, 56 std::unique_ptr<TextRenderer> text_renderer,
57 base::WeakPtr<PipelineImpl> weak_pipeline); 57 base::WeakPtr<PipelineImpl> weak_pipeline);
58 void Stop(const base::Closure& stop_cb); 58 void Stop(const base::Closure& stop_cb);
59 void Seek(base::TimeDelta time); 59 void Seek(base::TimeDelta time);
60 void Suspend(); 60 void Suspend();
61 void Resume(std::unique_ptr<Renderer> renderer, base::TimeDelta time); 61 void Resume(std::unique_ptr<Renderer> renderer, base::TimeDelta time);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void SetState(State next_state); 142 void SetState(State next_state);
143 void CompleteSeek(base::TimeDelta seek_time, PipelineStatus status); 143 void CompleteSeek(base::TimeDelta seek_time, PipelineStatus status);
144 void CompleteSuspend(PipelineStatus status); 144 void CompleteSuspend(PipelineStatus status);
145 void InitializeDemuxer(const PipelineStatusCB& done_cb); 145 void InitializeDemuxer(const PipelineStatusCB& done_cb);
146 void InitializeRenderer(const PipelineStatusCB& done_cb); 146 void InitializeRenderer(const PipelineStatusCB& done_cb);
147 void DestroyRenderer(); 147 void DestroyRenderer();
148 void ReportMetadata(); 148 void ReportMetadata();
149 149
150 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_; 150 const scoped_refptr<base::SingleThreadTaskRunner> media_task_runner_;
151 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; 151 const scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
152 const scoped_refptr<MediaLog> media_log_; 152 MediaLog* const media_log_;
153 153
154 base::WeakPtr<PipelineImpl> weak_pipeline_; 154 base::WeakPtr<PipelineImpl> weak_pipeline_;
155 Demuxer* demuxer_; 155 Demuxer* demuxer_;
156 std::unique_ptr<TextRenderer> text_renderer_; 156 std::unique_ptr<TextRenderer> text_renderer_;
157 double playback_rate_; 157 double playback_rate_;
158 float volume_; 158 float volume_;
159 CdmContext* cdm_context_; 159 CdmContext* cdm_context_;
160 160
161 // Lock used to serialize |shared_state_|. 161 // Lock used to serialize |shared_state_|.
162 mutable base::Lock shared_state_lock_; 162 mutable base::Lock shared_state_lock_;
(...skipping 17 matching lines...) Expand all
180 // Series of tasks to Start(), Seek(), and Resume(). 180 // Series of tasks to Start(), Seek(), and Resume().
181 std::unique_ptr<SerialRunner> pending_callbacks_; 181 std::unique_ptr<SerialRunner> pending_callbacks_;
182 182
183 base::WeakPtr<RendererWrapper> weak_this_; 183 base::WeakPtr<RendererWrapper> weak_this_;
184 base::WeakPtrFactory<RendererWrapper> weak_factory_; 184 base::WeakPtrFactory<RendererWrapper> weak_factory_;
185 DISALLOW_COPY_AND_ASSIGN(RendererWrapper); 185 DISALLOW_COPY_AND_ASSIGN(RendererWrapper);
186 }; 186 };
187 187
188 PipelineImpl::RendererWrapper::RendererWrapper( 188 PipelineImpl::RendererWrapper::RendererWrapper(
189 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner, 189 scoped_refptr<base::SingleThreadTaskRunner> media_task_runner,
190 scoped_refptr<MediaLog> media_log) 190 MediaLog* media_log)
191 : media_task_runner_(std::move(media_task_runner)), 191 : media_task_runner_(std::move(media_task_runner)),
192 main_task_runner_(base::ThreadTaskRunnerHandle::Get()), 192 main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
193 media_log_(std::move(media_log)), 193 media_log_(media_log),
194 demuxer_(nullptr), 194 demuxer_(nullptr),
195 playback_rate_(kDefaultPlaybackRate), 195 playback_rate_(kDefaultPlaybackRate),
196 volume_(kDefaultVolume), 196 volume_(kDefaultVolume),
197 cdm_context_(nullptr), 197 cdm_context_(nullptr),
198 state_(kCreated), 198 state_(kCreated),
199 status_(PIPELINE_OK), 199 status_(PIPELINE_OK),
200 renderer_ended_(false), 200 renderer_ended_(false),
201 text_renderer_ended_(false), 201 text_renderer_ended_(false),
202 weak_factory_(this) { 202 weak_factory_(this) {
203 weak_this_ = weak_factory_.GetWeakPtr(); 203 weak_this_ = weak_factory_.GetWeakPtr();
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 void PipelineImpl::OnSuspendDone() { 1362 void PipelineImpl::OnSuspendDone() {
1363 DVLOG(3) << __func__; 1363 DVLOG(3) << __func__;
1364 DCHECK(thread_checker_.CalledOnValidThread()); 1364 DCHECK(thread_checker_.CalledOnValidThread());
1365 DCHECK(IsRunning()); 1365 DCHECK(IsRunning());
1366 1366
1367 DCHECK(!suspend_cb_.is_null()); 1367 DCHECK(!suspend_cb_.is_null());
1368 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK); 1368 base::ResetAndReturn(&suspend_cb_).Run(PIPELINE_OK);
1369 } 1369 }
1370 1370
1371 } // namespace media 1371 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline_impl.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698