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

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

Issue 1915443003: Replace scoped_ptr with std::unique_ptr in //media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptr-media-base
Patch Set: scopedptr-media: rebase Created 4 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/renderers/renderer_impl_unittest.cc ('k') | media/renderers/video_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VIDEO_RENDERER_IMPL_H_ 5 #ifndef MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_
6 #define MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ 6 #define MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <deque> 11 #include <deque>
12 #include <memory>
12 13
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 16 #include "base/memory/scoped_vector.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/synchronization/condition_variable.h" 18 #include "base/synchronization/condition_variable.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/timer/timer.h" 20 #include "base/timer/timer.h"
21 #include "media/base/decryptor.h" 21 #include "media/base/decryptor.h"
22 #include "media/base/demuxer_stream.h" 22 #include "media/base/demuxer_stream.h"
23 #include "media/base/media_log.h" 23 #include "media/base/media_log.h"
24 #include "media/base/pipeline_status.h" 24 #include "media/base/pipeline_status.h"
25 #include "media/base/video_decoder.h" 25 #include "media/base/video_decoder.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const StatisticsCB& statistics_cb, 69 const StatisticsCB& statistics_cb,
70 const BufferingStateCB& buffering_state_cb, 70 const BufferingStateCB& buffering_state_cb,
71 const base::Closure& ended_cb, 71 const base::Closure& ended_cb,
72 const PipelineStatusCB& error_cb, 72 const PipelineStatusCB& error_cb,
73 const TimeSource::WallClockTimeCB& wall_clock_time_cb, 73 const TimeSource::WallClockTimeCB& wall_clock_time_cb,
74 const base::Closure& waiting_for_decryption_key_cb) override; 74 const base::Closure& waiting_for_decryption_key_cb) override;
75 void Flush(const base::Closure& callback) override; 75 void Flush(const base::Closure& callback) override;
76 void StartPlayingFrom(base::TimeDelta timestamp) override; 76 void StartPlayingFrom(base::TimeDelta timestamp) override;
77 void OnTimeStateChanged(bool time_progressing) override; 77 void OnTimeStateChanged(bool time_progressing) override;
78 78
79 void SetTickClockForTesting(scoped_ptr<base::TickClock> tick_clock); 79 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
80 void SetGpuMemoryBufferVideoForTesting( 80 void SetGpuMemoryBufferVideoForTesting(
81 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool); 81 std::unique_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool);
82 size_t frames_queued_for_testing() const { 82 size_t frames_queued_for_testing() const {
83 return algorithm_->frames_queued(); 83 return algorithm_->frames_queued();
84 } 84 }
85 85
86 // VideoRendererSink::RenderCallback implementation. 86 // VideoRendererSink::RenderCallback implementation.
87 scoped_refptr<VideoFrame> Render(base::TimeTicks deadline_min, 87 scoped_refptr<VideoFrame> Render(base::TimeTicks deadline_min,
88 base::TimeTicks deadline_max, 88 base::TimeTicks deadline_max,
89 bool background_rendering) override; 89 bool background_rendering) override;
90 void OnFrameDropped() override; 90 void OnFrameDropped() override;
91 91
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // might deadlock. Do not call Start() or Stop() on the sink directly, use 181 // might deadlock. Do not call Start() or Stop() on the sink directly, use
182 // StartSink() and StopSink() to ensure background rendering is started. Only 182 // StartSink() and StopSink() to ensure background rendering is started. Only
183 // access these values on |task_runner_|. 183 // access these values on |task_runner_|.
184 VideoRendererSink* const sink_; 184 VideoRendererSink* const sink_;
185 bool sink_started_; 185 bool sink_started_;
186 186
187 // Used for accessing data members. 187 // Used for accessing data members.
188 base::Lock lock_; 188 base::Lock lock_;
189 189
190 // Provides video frames to VideoRendererImpl. 190 // Provides video frames to VideoRendererImpl.
191 scoped_ptr<VideoFrameStream> video_frame_stream_; 191 std::unique_ptr<VideoFrameStream> video_frame_stream_;
192 192
193 // Pool of GpuMemoryBuffers and resources used to create hardware frames. 193 // Pool of GpuMemoryBuffers and resources used to create hardware frames.
194 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; 194 std::unique_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_;
195 195
196 scoped_refptr<MediaLog> media_log_; 196 scoped_refptr<MediaLog> media_log_;
197 197
198 // Flag indicating low-delay mode. 198 // Flag indicating low-delay mode.
199 bool low_delay_; 199 bool low_delay_;
200 200
201 // Keeps track of whether we received the end of stream buffer and finished 201 // Keeps track of whether we received the end of stream buffer and finished
202 // rendering. 202 // rendering.
203 bool received_end_of_stream_; 203 bool received_end_of_stream_;
204 bool rendered_end_of_stream_; 204 bool rendered_end_of_stream_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 PipelineStatusCB error_cb_; 254 PipelineStatusCB error_cb_;
255 TimeSource::WallClockTimeCB wall_clock_time_cb_; 255 TimeSource::WallClockTimeCB wall_clock_time_cb_;
256 256
257 base::TimeDelta start_timestamp_; 257 base::TimeDelta start_timestamp_;
258 258
259 // Keeps track of the number of frames decoded and dropped since the 259 // Keeps track of the number of frames decoded and dropped since the
260 // last call to |statistics_cb_|. These must be accessed under lock. 260 // last call to |statistics_cb_|. These must be accessed under lock.
261 int frames_decoded_; 261 int frames_decoded_;
262 int frames_dropped_; 262 int frames_dropped_;
263 263
264 scoped_ptr<base::TickClock> tick_clock_; 264 std::unique_ptr<base::TickClock> tick_clock_;
265 265
266 // Algorithm for selecting which frame to render; manages frames and all 266 // Algorithm for selecting which frame to render; manages frames and all
267 // timing related information. 267 // timing related information.
268 scoped_ptr<VideoRendererAlgorithm> algorithm_; 268 std::unique_ptr<VideoRendererAlgorithm> algorithm_;
269 269
270 // Indicates that Render() was called with |background_rendering| set to true, 270 // Indicates that Render() was called with |background_rendering| set to true,
271 // so we've entered a background rendering mode where dropped frames are not 271 // so we've entered a background rendering mode where dropped frames are not
272 // counted. Must be accessed under |lock_| once |sink_| is started. 272 // counted. Must be accessed under |lock_| once |sink_| is started.
273 bool was_background_rendering_; 273 bool was_background_rendering_;
274 274
275 // Indicates whether or not media time is currently progressing or not. Must 275 // Indicates whether or not media time is currently progressing or not. Must
276 // only be accessed from |task_runner_|. 276 // only be accessed from |task_runner_|.
277 bool time_progressing_; 277 bool time_progressing_;
278 278
279 // Indicates that Render() should only render the first frame and then request 279 // Indicates that Render() should only render the first frame and then request
280 // that the sink be stopped. |posted_maybe_stop_after_first_paint_| is used 280 // that the sink be stopped. |posted_maybe_stop_after_first_paint_| is used
281 // to avoid repeated task posts. 281 // to avoid repeated task posts.
282 bool render_first_frame_and_stop_; 282 bool render_first_frame_and_stop_;
283 bool posted_maybe_stop_after_first_paint_; 283 bool posted_maybe_stop_after_first_paint_;
284 284
285 // Memory usage of |algorithm_| recorded during the last UpdateStats_Locked() 285 // Memory usage of |algorithm_| recorded during the last UpdateStats_Locked()
286 // call. 286 // call.
287 int64_t last_video_memory_usage_; 287 int64_t last_video_memory_usage_;
288 288
289 // NOTE: Weak pointers must be invalidated before all other member variables. 289 // NOTE: Weak pointers must be invalidated before all other member variables.
290 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; 290 base::WeakPtrFactory<VideoRendererImpl> weak_factory_;
291 291
292 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); 292 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl);
293 }; 293 };
294 294
295 } // namespace media 295 } // namespace media
296 296
297 #endif // MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ 297 #endif // MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/renderers/renderer_impl_unittest.cc ('k') | media/renderers/video_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698