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

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

Issue 10749019: VideoDecodeAccelerator now SupportsWeakPtr instead of being RefCountedThreadSafe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 | Annotate | Revision Log
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 #ifndef CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/ref_counted.h"
19 #include "base/message_loop.h" 18 #include "base/message_loop.h"
20 #include "base/shared_memory.h" 19 #include "base/shared_memory.h"
21 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
22 #include "media/video/video_decode_accelerator.h" 21 #include "media/video/video_decode_accelerator.h"
23 #include "third_party/angle/include/EGL/egl.h" 22 #include "third_party/angle/include/EGL/egl.h"
24 #include "third_party/angle/include/EGL/eglext.h" 23 #include "third_party/angle/include/EGL/eglext.h"
25 #include "third_party/openmax/il/OMX_Component.h" 24 #include "third_party/openmax/il/OMX_Component.h"
26 #include "third_party/openmax/il/OMX_Core.h" 25 #include "third_party/openmax/il/OMX_Core.h"
27 #include "third_party/openmax/il/OMX_Video.h" 26 #include "third_party/openmax/il/OMX_Video.h"
28 27
29 class Gles2TextureToEglImageTranslator; 28 class Gles2TextureToEglImageTranslator;
30 29
31 // Class to wrap OpenMAX IL accelerator behind VideoDecodeAccelerator interface. 30 // Class to wrap OpenMAX IL accelerator behind VideoDecodeAccelerator interface.
32 // The implementation assumes an OpenMAX IL 1.1.2 implementation conforming to 31 // The implementation assumes an OpenMAX IL 1.1.2 implementation conforming to
33 // http://www.khronos.org/registry/omxil/specs/OpenMAX_IL_1_1_2_Specification.pd f 32 // http://www.khronos.org/registry/omxil/specs/OpenMAX_IL_1_1_2_Specification.pd f
34 // 33 //
35 // This class lives on a single thread and DCHECKs that it is never accessed 34 // This class lives on a single thread and DCHECKs that it is never accessed
36 // from any other. OMX callbacks are trampolined from the OMX component's 35 // from any other. OMX callbacks are trampolined from the OMX component's
37 // thread to maintain this invariant. The only exception to thread-unsafety is 36 // thread to maintain this invariant. The only exception to thread-unsafety is
38 // that references can be added from any thread (practically used only by the 37 // that references can be added from any thread (practically used only by the
39 // OMX thread). 38 // OMX thread).
40 class CONTENT_EXPORT OmxVideoDecodeAccelerator : 39 class CONTENT_EXPORT OmxVideoDecodeAccelerator :
41 public media::VideoDecodeAccelerator { 40 public media::VideoDecodeAccelerator {
42 public: 41 public:
43 // Does not take ownership of |client| which must outlive |*this|. 42 // Does not take ownership of |client| which must outlive |*this|.
44 OmxVideoDecodeAccelerator(media::VideoDecodeAccelerator::Client* client); 43 OmxVideoDecodeAccelerator(media::VideoDecodeAccelerator::Client* client);
44 virtual ~OmxVideoDecodeAccelerator();
45 45
46 // media::VideoDecodeAccelerator implementation. 46 // media::VideoDecodeAccelerator implementation.
47 bool Initialize(media::VideoCodecProfile profile) OVERRIDE; 47 bool Initialize(media::VideoCodecProfile profile) OVERRIDE;
48 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; 48 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE;
49 virtual void AssignPictureBuffers( 49 virtual void AssignPictureBuffers(
50 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; 50 const std::vector<media::PictureBuffer>& buffers) OVERRIDE;
51 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; 51 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE;
52 void Flush() OVERRIDE; 52 void Flush() OVERRIDE;
53 void Reset() OVERRIDE; 53 void Reset() OVERRIDE;
54 void Destroy() OVERRIDE; 54 void Destroy(scoped_ptr<VideoDecodeAccelerator> self) OVERRIDE;
55 55
56 void SetEglState(EGLDisplay egl_display, EGLContext egl_context); 56 void SetEglState(EGLDisplay egl_display, EGLContext egl_context);
57 57
58 private: 58 private:
59 virtual ~OmxVideoDecodeAccelerator();
60
61 // Because OMX state-transitions are described solely by the "state reached" 59 // Because OMX state-transitions are described solely by the "state reached"
62 // (3.1.2.9.1, table 3-7 of the spec), we track what transition was requested 60 // (3.1.2.9.1, table 3-7 of the spec), we track what transition was requested
63 // using this enum. Note that it is an error to request a transition while 61 // using this enum. Note that it is an error to request a transition while
64 // |*this| is in any state other than NO_TRANSITION, unless requesting 62 // |*this| is in any state other than NO_TRANSITION, unless requesting
65 // DESTROYING or ERRORING. 63 // DESTROYING or ERRORING.
66 enum CurrentStateChange { 64 enum CurrentStateChange {
67 NO_TRANSITION, // Not in the middle of a transition. 65 NO_TRANSITION, // Not in the middle of a transition.
68 INITIALIZING, 66 INITIALIZING,
69 FLUSHING, 67 FLUSHING,
70 RESETTING, 68 RESETTING,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // (i.e. the source state is uniquely defined by the pair). 105 // (i.e. the source state is uniquely defined by the pair).
108 void OnReachedIdleInInitializing(); 106 void OnReachedIdleInInitializing();
109 void OnReachedExecutingInInitializing(); 107 void OnReachedExecutingInInitializing();
110 void OnReachedPauseInResetting(); 108 void OnReachedPauseInResetting();
111 void OnReachedExecutingInResetting(); 109 void OnReachedExecutingInResetting();
112 void OnReachedIdleInDestroying(); 110 void OnReachedIdleInDestroying();
113 void OnReachedLoadedInDestroying(); 111 void OnReachedLoadedInDestroying();
114 void OnReachedEOSInFlushing(); 112 void OnReachedEOSInFlushing();
115 void OnReachedInvalidInErroring(); 113 void OnReachedInvalidInErroring();
116 void ShutdownComponent(); 114 void ShutdownComponent();
117 void BusyLoopInDestroying(); 115 void BusyLoopInDestroying(scoped_ptr<VideoDecodeAccelerator> self);
118 116
119 // Port-flushing helpers. 117 // Port-flushing helpers.
120 void FlushIOPorts(); 118 void FlushIOPorts();
121 void InputPortFlushDone(); 119 void InputPortFlushDone();
122 void OutputPortFlushDone(); 120 void OutputPortFlushDone();
123 121
124 // Stop the component when any error is detected. 122 // Stop the component when any error is detected.
125 void StopOnError(media::VideoDecodeAccelerator::Error error); 123 void StopOnError(media::VideoDecodeAccelerator::Error error);
126 124
127 // Determine whether we can issue fill buffer to the decoder based on the 125 // Determine whether we can issue fill buffer to the decoder based on the
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 OMX_PTR event_data); 220 OMX_PTR event_data);
223 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component, 221 static OMX_ERRORTYPE EmptyBufferCallback(OMX_HANDLETYPE component,
224 OMX_PTR priv_data, 222 OMX_PTR priv_data,
225 OMX_BUFFERHEADERTYPE* buffer); 223 OMX_BUFFERHEADERTYPE* buffer);
226 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component, 224 static OMX_ERRORTYPE FillBufferCallback(OMX_HANDLETYPE component,
227 OMX_PTR priv_data, 225 OMX_PTR priv_data,
228 OMX_BUFFERHEADERTYPE* buffer); 226 OMX_BUFFERHEADERTYPE* buffer);
229 }; 227 };
230 228
231 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_ 229 #endif // CONTENT_COMMON_GPU_MEDIA_OMX_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698