Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | |
| 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | |
| 7 | |
| 8 #include <dlfcn.h> | |
| 9 #include <map> | |
| 10 #include <queue> | |
| 11 #include <set> | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
unused
dwkang1
2013/01/28 14:54:30
Done.
| |
| 12 #include <string> | |
| 13 #include <utility> | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
unused?
dwkang1
2013/01/28 14:54:30
Done.
| |
| 14 #include <vector> | |
| 15 | |
| 16 #include "base/compiler_specific.h" | |
| 17 #include "base/logging.h" | |
| 18 #include "base/message_loop.h" | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
replace with fwd-declaration
dwkang1
2013/01/28 14:54:30
Done.
| |
| 19 #include "base/shared_memory.h" | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
unnecessary (please audit the rest of the #include
dwkang1
2013/01/28 14:54:30
Done.
| |
| 20 #include "content/common/android/surface_texture_bridge.h" | |
| 21 #include "content/common/content_export.h" | |
| 22 #include "media/video/video_decode_accelerator.h" | |
| 23 | |
| 24 namespace media { | |
| 25 class MediaCodecBridge; | |
| 26 } | |
| 27 | |
| 28 namespace content { | |
| 29 | |
| 30 class Gles2ExternalTextureCopier; | |
| 31 | |
| 32 typedef std::map<int32, media::PictureBuffer> PictureMap; | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
Only used for a private member; move into the priv
dwkang1
2013/01/28 14:54:30
Done.
| |
| 33 | |
| 34 // A VideoDecodeAccelerator implementation for Android. | |
| 35 // This class decodes the input encoded stream by using Android's MediaCodec | |
| 36 // class. http://developer.android.com/reference/android/media/MediaCodec.html | |
| 37 class CONTENT_EXPORT AndroidVideoDecodeAccelerator : | |
| 38 public media::VideoDecodeAccelerator { | |
| 39 public: | |
| 40 // Does not take ownership of |client| which must outlive |*this|. | |
| 41 AndroidVideoDecodeAccelerator( | |
| 42 media::VideoDecodeAccelerator::Client* client, | |
| 43 const base::Callback<bool(void)>& make_context_current); | |
| 44 virtual ~AndroidVideoDecodeAccelerator(); | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
dtor should be private since only Destroy should b
dwkang1
2013/01/28 14:54:30
Done.
| |
| 45 | |
| 46 // media::VideoDecodeAccelerator implementation. | |
| 47 bool Initialize(media::VideoCodecProfile profile) OVERRIDE; | |
| 48 void Decode(const media::BitstreamBuffer& bitstream_buffer) OVERRIDE; | |
| 49 virtual void AssignPictureBuffers( | |
| 50 const std::vector<media::PictureBuffer>& buffers) OVERRIDE; | |
| 51 void ReusePictureBuffer(int32 picture_buffer_id) OVERRIDE; | |
| 52 void Flush() OVERRIDE; | |
| 53 void Reset() OVERRIDE; | |
| 54 void Destroy() OVERRIDE; | |
| 55 | |
| 56 private: | |
| 57 enum Codec { | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
You can drop this enum and the codec_ parameter by
dwkang1
2013/01/28 14:54:30
Actually, codec_ is needed when we reconfigure Med
| |
| 58 UNKNOWN, | |
| 59 H264, | |
| 60 VP8 | |
| 61 }; | |
| 62 enum State { | |
| 63 NO_ERROR, | |
| 64 ERROR, | |
| 65 }; | |
| 66 | |
| 67 static const base::TimeDelta kDecodePollDelay; | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
I don't know what this is used for yet, but I susp
dwkang1
2013/01/28 14:54:30
As you found, I am afraid that I have to say Media
| |
| 68 | |
| 69 void SendCurrentSurfaceToClient(); | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
You need to document everything that's not obvious
dwkang1
2013/01/28 14:54:30
Done.
| |
| 70 void CopyCurrentFrameToPictureBuffer( | |
| 71 int32 picture_buffer_id, float transfrom_matrix[16]); | |
| 72 | |
| 73 void DoDecode(); | |
| 74 void ConfigureMediaCodec(); | |
| 75 void QueueInput(); | |
| 76 void DequeueOutput(); | |
| 77 | |
| 78 MessageLoop* message_loop_; | |
| 79 | |
| 80 // To expose client callbacks from VideoDecodeAccelerator. | |
| 81 // NOTE: all calls to this object *MUST* be executed in message_loop_. | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
This is the first time there's an implication that
dwkang1
2013/01/28 14:54:30
That is not true. I should have deleted this comme
| |
| 82 Client* client_; | |
| 83 | |
| 84 base::Callback<bool(void)> make_context_current_; | |
| 85 | |
| 86 // These members are only used during Initialization. | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
I think this comment refers to just one member, so
dwkang1
2013/01/28 14:54:30
Ditto. My bad. I should have removed this also.
| |
| 87 Codec codec_; | |
| 88 | |
| 89 State state_; | |
| 90 PictureMap picture_map_; | |
| 91 std::queue<int32> free_picture_ids_; | |
| 92 scoped_ptr<media::MediaCodecBridge> media_codec_; | |
| 93 scoped_refptr<SurfaceTextureBridge> surface_texture_; | |
| 94 uint32 surface_texture_id_; | |
| 95 bool picturebuffer_requested_; | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
s/buffer/buffers/ ?
dwkang1
2013/01/28 14:54:30
Done.
| |
| 96 | |
| 97 typedef std::queue<media::BitstreamBuffer> BitstreamBufferList; | |
| 98 BitstreamBufferList pending_bitstream_buffers_; | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
pending where? At the decoder or awaiting submiss
dwkang1
2013/01/28 14:54:30
Done.
| |
| 99 | |
| 100 int32 color_format_; | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
Can this not be a more specifically-typed member?
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
I believe this and the next two members (width/hei
dwkang1
2013/01/28 14:54:30
Done.
dwkang1
2013/01/28 14:54:30
Done.
| |
| 101 int32 width_; | |
| 102 int32 height_; | |
|
Ami GONE FROM CHROMIUM
2013/01/23 01:32:32
Replace width/height with gfx::Size
dwkang1
2013/01/28 14:54:30
Removed.
| |
| 103 int32 current_bitstream_id_; | |
| 104 | |
| 105 scoped_ptr<Gles2ExternalTextureCopier> texture_copier_; | |
| 106 }; | |
| 107 | |
| 108 } // namespace content | |
| 109 | |
| 110 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ | |
| OLD | NEW |