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

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

Issue 14932020: Add Create() function to AudioCodecBridge and VideoCodecBridge to allow return of null pointers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 7 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 #include <queue> 11 #include <queue>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 18 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
20 #include "media/base/android/media_codec_bridge.h" 20 #include "media/base/android/media_codec_bridge.h"
21 #include "media/video/video_decode_accelerator.h" 21 #include "media/video/video_decode_accelerator.h"
22 22
23 namespace gfx { 23 namespace gfx {
24 class SurfaceTextureBridge; 24 class SurfaceTextureBridge;
25 } 25 }
26 26
27 namespace content { 27 namespace content {
28
29 // A VideoDecodeAccelerator implementation for Android. 28 // A VideoDecodeAccelerator implementation for Android.
30 // This class decodes the input encoded stream by using Android's MediaCodec 29 // This class decodes the input encoded stream by using Android's MediaCodec
31 // class. http://developer.android.com/reference/android/media/MediaCodec.html 30 // class. http://developer.android.com/reference/android/media/MediaCodec.html
32 class CONTENT_EXPORT AndroidVideoDecodeAccelerator : 31 class CONTENT_EXPORT AndroidVideoDecodeAccelerator :
33 public media::VideoDecodeAccelerator { 32 public media::VideoDecodeAccelerator {
34 public: 33 public:
35 // Does not take ownership of |client| which must outlive |*this|. 34 // Does not take ownership of |client| which must outlive |*this|.
36 AndroidVideoDecodeAccelerator( 35 AndroidVideoDecodeAccelerator(
37 media::VideoDecodeAccelerator::Client* client, 36 media::VideoDecodeAccelerator::Client* client,
38 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder, 37 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder,
(...skipping 13 matching lines...) Expand all
52 enum State { 51 enum State {
53 NO_ERROR, 52 NO_ERROR,
54 ERROR, 53 ERROR,
55 }; 54 };
56 55
57 static const base::TimeDelta kDecodePollDelay; 56 static const base::TimeDelta kDecodePollDelay;
58 57
59 virtual ~AndroidVideoDecodeAccelerator(); 58 virtual ~AndroidVideoDecodeAccelerator();
60 59
61 // Configures |media_codec_| with the given codec parameters from the client. 60 // Configures |media_codec_| with the given codec parameters from the client.
62 void ConfigureMediaCodec(); 61 bool ConfigureMediaCodec();
63 62
64 // Sends the current picture on the surface to the client. 63 // Sends the current picture on the surface to the client.
65 void SendCurrentSurfaceToClient(int32 bitstream_id); 64 void SendCurrentSurfaceToClient(int32 bitstream_id);
66 65
67 // Does pending IO tasks if any. Once this is called, it polls |media_codec_| 66 // Does pending IO tasks if any. Once this is called, it polls |media_codec_|
68 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is 67 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is
69 // used. 68 // used.
70 void DoIOTask(); 69 void DoIOTask();
71 70
72 // Feeds input data to |media_codec_|. This checks 71 // Feeds input data to |media_codec_|. This checks
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 155
157 // Keeps track of bitstream ids notified to the client with 156 // Keeps track of bitstream ids notified to the client with
158 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream. 157 // NotifyEndOfBitstreamBuffer() before getting output from the bitstream.
159 std::list<int32> bitstreams_notified_in_advance_; 158 std::list<int32> bitstreams_notified_in_advance_;
160 159
161 // Owner of the GL context. Used to restore the context state. 160 // Owner of the GL context. Used to restore the context state.
162 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_; 161 base::WeakPtr<gpu::gles2::GLES2Decoder> gl_decoder_;
163 162
164 // Used for copy the texture from |surface_texture_| to picture buffers. 163 // Used for copy the texture from |surface_texture_| to picture buffers.
165 scoped_ptr<gpu::CopyTextureCHROMIUMResourceManager> copier_; 164 scoped_ptr<gpu::CopyTextureCHROMIUMResourceManager> copier_;
165
166 friend class AndroidVideoDecodeAcceleratorTest;
166 }; 167 };
167 168
168 } // namespace content 169 } // namespace content
169 170
170 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 171 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698