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

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

Issue 1273943002: media: Make GpuMemoryBuffers VideoFrame copies asynchronous. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman's and dalecurtis' comments. Disable GMB VideoFrames. Created 5 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/renderers/default_renderer_factory.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 <deque> 8 #include <deque>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 public base::PlatformThread::Delegate { 45 public base::PlatformThread::Delegate {
46 public: 46 public:
47 // |decoders| contains the VideoDecoders to use when initializing. 47 // |decoders| contains the VideoDecoders to use when initializing.
48 // 48 //
49 // Implementors should avoid doing any sort of heavy work in this method and 49 // Implementors should avoid doing any sort of heavy work in this method and
50 // instead post a task to a common/worker thread to handle rendering. Slowing 50 // instead post a task to a common/worker thread to handle rendering. Slowing
51 // down the video thread may result in losing synchronization with audio. 51 // down the video thread may result in losing synchronization with audio.
52 // 52 //
53 // Setting |drop_frames_| to true causes the renderer to drop expired frames. 53 // Setting |drop_frames_| to true causes the renderer to drop expired frames.
54 VideoRendererImpl( 54 VideoRendererImpl(
55 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 55 const scoped_refptr<base::SingleThreadTaskRunner>& media_task_runner,
56 const scoped_refptr<base::TaskRunner>& worker_task_runner,
56 VideoRendererSink* sink, 57 VideoRendererSink* sink,
57 ScopedVector<VideoDecoder> decoders, 58 ScopedVector<VideoDecoder> decoders,
58 bool drop_frames, 59 bool drop_frames,
59 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, 60 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories,
60 const scoped_refptr<MediaLog>& media_log); 61 const scoped_refptr<MediaLog>& media_log);
61 ~VideoRendererImpl() override; 62 ~VideoRendererImpl() override;
62 63
63 // VideoRenderer implementation. 64 // VideoRenderer implementation.
64 void Initialize(DemuxerStream* stream, 65 void Initialize(DemuxerStream* stream,
65 const PipelineStatusCB& init_cb, 66 const PipelineStatusCB& init_cb,
(...skipping 24 matching lines...) Expand all
90 } 91 }
91 92
92 private: 93 private:
93 // Creates a dedicated |thread_| for video rendering. 94 // Creates a dedicated |thread_| for video rendering.
94 void CreateVideoThread(); 95 void CreateVideoThread();
95 96
96 // Callback for |video_frame_stream_| initialization. 97 // Callback for |video_frame_stream_| initialization.
97 void OnVideoFrameStreamInitialized(bool success); 98 void OnVideoFrameStreamInitialized(bool success);
98 99
99 // Callback for |video_frame_stream_| to deliver decoded video frames and 100 // Callback for |video_frame_stream_| to deliver decoded video frames and
101 // report video decoding status. If a frame is available the planes will be
102 // copied asynchronously and FrameReady will be called once finished copying.
103 void FrameReadyForCopyingToGpuMemoryBuffers(
104 VideoFrameStream::Status status,
105 const scoped_refptr<VideoFrame>& frame);
106
107 // Callback for |video_frame_stream_| to deliver decoded video frames and
100 // report video decoding status. 108 // report video decoding status.
101 void FrameReady(VideoFrameStream::Status status, 109 void FrameReady(VideoFrameStream::Status status,
102 const scoped_refptr<VideoFrame>& frame); 110 const scoped_refptr<VideoFrame>& frame);
103 111
104 // Helper method for adding a frame to |ready_frames_|. 112 // Helper method for adding a frame to |ready_frames_|.
105 void AddReadyFrame_Locked(const scoped_refptr<VideoFrame>& frame); 113 void AddReadyFrame_Locked(const scoped_refptr<VideoFrame>& frame);
106 114
107 // Helper method that schedules an asynchronous read from the 115 // Helper method that schedules an asynchronous read from the
108 // |video_frame_stream_| as long as there isn't a pending read and we have 116 // |video_frame_stream_| as long as there isn't a pending read and we have
109 // capacity. 117 // capacity.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 301
294 // NOTE: Weak pointers must be invalidated before all other member variables. 302 // NOTE: Weak pointers must be invalidated before all other member variables.
295 base::WeakPtrFactory<VideoRendererImpl> weak_factory_; 303 base::WeakPtrFactory<VideoRendererImpl> weak_factory_;
296 304
297 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); 305 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl);
298 }; 306 };
299 307
300 } // namespace media 308 } // namespace media
301 309
302 #endif // MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_ 310 #endif // MEDIA_RENDERERS_VIDEO_RENDERER_IMPL_H_
OLDNEW
« no previous file with comments | « media/renderers/default_renderer_factory.cc ('k') | media/renderers/video_renderer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698