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

Side by Side Diff: content/common/gpu/media/v4l2_video_decode_accelerator.h

Issue 833063003: Add accelerated video decoder interface, VP8 and H.264 implementations and hook up to V4L2SVDA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 // This file contains an implementation of VideoDecodeAccelerator 5 // This file contains an implementation of VideoDecodeAccelerator
6 // that utilizes hardware video decoders, which expose Video4Linux 2 API 6 // that utilizes hardware video decoders, which expose Video4Linux 2 API
7 // (http://linuxtv.org/downloads/v4l-dvb-apis/). 7 // (http://linuxtv.org/downloads/v4l-dvb-apis/).
8 8
9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ 9 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_
10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ 10 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_
11 11
12 #include <queue> 12 #include <queue>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/callback_forward.h" 15 #include "base/callback_forward.h"
16 #include "base/memory/linked_ptr.h" 16 #include "base/memory/linked_ptr.h"
17 #include "base/memory/ref_counted.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "base/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
19 #include "base/threading/thread.h" 20 #include "base/threading/thread.h"
20 #include "content/common/content_export.h" 21 #include "content/common/content_export.h"
21 #include "content/common/gpu/media/v4l2_video_device.h" 22 #include "content/common/gpu/media/v4l2_video_device.h"
22 #include "media/base/limits.h" 23 #include "media/base/limits.h"
23 #include "media/base/video_decoder_config.h" 24 #include "media/base/video_decoder_config.h"
24 #include "media/video/picture.h" 25 #include "media/video/picture.h"
25 #include "media/video/video_decode_accelerator.h" 26 #include "media/video/video_decode_accelerator.h"
26 #include "ui/gfx/geometry/size.h" 27 #include "ui/gfx/geometry/size.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 // subtle races (esp. if we get Reset() in the meantime), we block the decoder 74 // subtle races (esp. if we get Reset() in the meantime), we block the decoder
74 // thread while we wait for AssignPictureBuffers from the client. 75 // thread while we wait for AssignPictureBuffers from the client.
75 class CONTENT_EXPORT V4L2VideoDecodeAccelerator 76 class CONTENT_EXPORT V4L2VideoDecodeAccelerator
76 : public media::VideoDecodeAccelerator { 77 : public media::VideoDecodeAccelerator {
77 public: 78 public:
78 V4L2VideoDecodeAccelerator( 79 V4L2VideoDecodeAccelerator(
79 EGLDisplay egl_display, 80 EGLDisplay egl_display,
80 EGLContext egl_context, 81 EGLContext egl_context,
81 const base::WeakPtr<Client>& io_client_, 82 const base::WeakPtr<Client>& io_client_,
82 const base::Callback<bool(void)>& make_context_current, 83 const base::Callback<bool(void)>& make_context_current,
83 scoped_ptr<V4L2Device> device, 84 const scoped_refptr<V4L2Device>& device,
84 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy); 85 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy);
85 virtual ~V4L2VideoDecodeAccelerator(); 86 virtual ~V4L2VideoDecodeAccelerator();
86 87
87 // media::VideoDecodeAccelerator implementation. 88 // media::VideoDecodeAccelerator implementation.
88 // Note: Initialize() and Destroy() are synchronous. 89 // Note: Initialize() and Destroy() are synchronous.
89 virtual bool Initialize(media::VideoCodecProfile profile, 90 virtual bool Initialize(media::VideoCodecProfile profile,
90 Client* client) override; 91 Client* client) override;
91 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; 92 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override;
92 virtual void AssignPictureBuffers( 93 virtual void AssignPictureBuffers(
93 const std::vector<media::PictureBuffer>& buffers) override; 94 const std::vector<media::PictureBuffer>& buffers) override;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // 334 //
334 335
335 // This thread services tasks posted from the VDA API entry points by the 336 // This thread services tasks posted from the VDA API entry points by the
336 // child thread and device service callbacks posted from the device thread. 337 // child thread and device service callbacks posted from the device thread.
337 base::Thread decoder_thread_; 338 base::Thread decoder_thread_;
338 // Decoder state machine state. 339 // Decoder state machine state.
339 State decoder_state_; 340 State decoder_state_;
340 // BitstreamBuffer we're presently reading. 341 // BitstreamBuffer we're presently reading.
341 scoped_ptr<BitstreamBufferRef> decoder_current_bitstream_buffer_; 342 scoped_ptr<BitstreamBufferRef> decoder_current_bitstream_buffer_;
342 // The V4L2Device this class is operating upon. 343 // The V4L2Device this class is operating upon.
343 scoped_ptr<V4L2Device> device_; 344 scoped_refptr<V4L2Device> device_;
344 // FlushTask() and ResetTask() should not affect buffers that have been 345 // FlushTask() and ResetTask() should not affect buffers that have been
345 // queued afterwards. For flushing or resetting the pipeline then, we will 346 // queued afterwards. For flushing or resetting the pipeline then, we will
346 // delay these buffers until after the flush or reset completes. 347 // delay these buffers until after the flush or reset completes.
347 int decoder_delay_bitstream_buffer_id_; 348 int decoder_delay_bitstream_buffer_id_;
348 // Input buffer we're presently filling. 349 // Input buffer we're presently filling.
349 int decoder_current_input_buffer_; 350 int decoder_current_input_buffer_;
350 // We track the number of buffer decode tasks we have scheduled, since each 351 // We track the number of buffer decode tasks we have scheduled, since each
351 // task execution should complete one buffer. If we fall behind (due to 352 // task execution should complete one buffer. If we fall behind (due to
352 // resource backpressure, etc.), we'll have to schedule more to catch up. 353 // resource backpressure, etc.), we'll have to schedule more to catch up.
353 int decoder_decode_buffer_tasks_scheduled_; 354 int decoder_decode_buffer_tasks_scheduled_;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 443
443 // The WeakPtrFactory for |weak_this_|. 444 // The WeakPtrFactory for |weak_this_|.
444 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_; 445 base::WeakPtrFactory<V4L2VideoDecodeAccelerator> weak_this_factory_;
445 446
446 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator); 447 DISALLOW_COPY_AND_ASSIGN(V4L2VideoDecodeAccelerator);
447 }; 448 };
448 449
449 } // namespace content 450 } // namespace content
450 451
451 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_ 452 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698