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

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

Issue 2692863011: Add ContentVideoViewOverlay to AVDA. (Closed)
Patch Set: make DequeueOutput require NO_ERROR from setsurface Created 3 years, 9 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 (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 MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 5 #ifndef MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 6 #define MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // AVDAStateProvider implementation: 69 // AVDAStateProvider implementation:
70 const gfx::Size& GetSize() const override; 70 const gfx::Size& GetSize() const override;
71 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override; 71 base::WeakPtr<gpu::gles2::GLES2Decoder> GetGlDecoder() const override;
72 // Notifies the client about the error and sets |state_| to |ERROR|. If we're 72 // Notifies the client about the error and sets |state_| to |ERROR|. If we're
73 // in the middle of Initialize, we guarantee that Initialize will return 73 // in the middle of Initialize, we guarantee that Initialize will return
74 // failure. If deferred init is pending, then we'll fail deferred init. 74 // failure. If deferred init is pending, then we'll fail deferred init.
75 // Otherwise, we'll signal errors normally. 75 // Otherwise, we'll signal errors normally.
76 void NotifyError(Error error) override; 76 void NotifyError(Error error) override;
77 77
78 // AVDACodecAllocatorClient implementation: 78 // AVDACodecAllocatorClient implementation:
79 void OnSurfaceAvailable(bool success) override;
80 void OnSurfaceDestroyed() override;
81 void OnCodecConfigured( 79 void OnCodecConfigured(
82 std::unique_ptr<MediaCodecBridge> media_codec) override; 80 std::unique_ptr<MediaCodecBridge> media_codec) override;
83 81
84 private: 82 private:
85 friend class AVDAManager; 83 friend class AVDAManager;
86 84
87 // TODO(timav): evaluate the need for more states in the AVDA state machine. 85 // TODO(timav): evaluate the need for more states in the AVDA state machine.
88 enum State { 86 enum State {
89 NO_ERROR, 87 NO_ERROR,
90 ERROR, 88 ERROR,
(...skipping 14 matching lines...) Expand all
105 103
106 enum DrainType { 104 enum DrainType {
107 DRAIN_FOR_FLUSH, 105 DRAIN_FOR_FLUSH,
108 DRAIN_FOR_RESET, 106 DRAIN_FOR_RESET,
109 DRAIN_FOR_DESTROY, 107 DRAIN_FOR_DESTROY,
110 }; 108 };
111 109
112 // Entry point for configuring / reconfiguring a codec with a new surface. 110 // Entry point for configuring / reconfiguring a codec with a new surface.
113 // Start surface creation by trying to allocate the surface id. Will either 111 // Start surface creation by trying to allocate the surface id. Will either
114 // InitializePictureBufferManager if the surface is available immediately, or 112 // InitializePictureBufferManager if the surface is available immediately, or
115 // will wait for OnSurfaceAvailable to do it. This will transition |state_| 113 // will wait for OnOverlayReady to do it. This will transition |state_|
116 // to WAITING_FOR_SURFACE or WAITING_FOR_CODEC, as needed (or NO_ERROR if it 114 // to WAITING_FOR_SURFACE or WAITING_FOR_CODEC, as needed (or NO_ERROR if it
117 // gets the surface and the codec without waiting). 115 // gets the surface and the codec without waiting).
118 // Note that this requires that you create a new |incoming_bundle_| with the 116 // Note that this requires that you create a new |incoming_bundle_| with the
119 // appropriate surface id. 117 // appropriate surface id.
120 void StartSurfaceCreation(); 118 void StartSurfaceCreation();
121 119
122 // Initialize of the picture buffer manager to use the current surface, once 120 // Called by AndroidOverlay when a surface becomes available.
121 void OnOverlayReady();
122
123 // Called by AndroidOverlay when the overlay will not call OnOverlayReady.
124 void OnOverlayFailed();
125
126 // Called by AndroidOverlay when a surface is lost.
127 void OnSurfaceDestroyed();
128
129 // Initializes the picture buffer manager to use the current surface, once
123 // it is available. This is not normally called directly, but rather via 130 // it is available. This is not normally called directly, but rather via
124 // StartSurfaceCreation. If we have a media codec already, then this will 131 // StartSurfaceCreation. If we have a media codec already, then this will
125 // attempt to setSurface the new surface. Otherwise, it will start codec 132 // attempt to setSurface the new surface. Otherwise, it will start codec
126 // config using the new surface. In that case, there might not be a codec 133 // config using the new surface. In that case, there might not be a codec
127 // ready even if this succeeds, but async config will be started. If 134 // ready even if this succeeds, but async config will be started. If
128 // setSurface fails, this will not replace the codec. On failure, this will 135 // setSurface fails, this will not replace the codec. On failure, this will
129 // transition |state_| to ERROR. 136 // transition |state_| to ERROR.
130 // Note that this assumes that there is an |incoming_bundle_| that we'll use. 137 // Note that this assumes that there is an |incoming_bundle_| that we'll use.
131 // On success, we'll replace the bundle in |codec_config_|. On failure, we'll 138 // On success, we'll replace the bundle in |codec_config_|. On failure, we'll
132 // delete the incoming bundle. 139 // delete the incoming bundle.
133 void InitializePictureBufferManager(); 140 void InitializePictureBufferManager();
134 141
135 // A part of destruction process that is sometimes postponed after the drain. 142 // A part of destruction process that is sometimes postponed after the drain.
136 void ActualDestroy(); 143 void ActualDestroy();
137 144
138 // Configures |media_codec_| with the given codec parameters from the client. 145 // Configures |media_codec_| with the given codec parameters from the client.
139 // This configuration will (probably) not be complete before this call 146 // This configuration will (probably) not be complete before this call
140 // returns. Multiple calls before completion will be ignored. |state_| 147 // returns. Multiple calls before completion will be ignored. |state_|
141 // must be NO_ERROR or WAITING_FOR_CODEC. Note that, once you call this, 148 // must be NO_ERROR or WAITING_FOR_CODEC. Note that, once you call this,
142 // you should be careful to avoid modifying members of |codec_config_| until 149 // you should be careful to avoid modifying members of |codec_config_| until
143 // |state_| is no longer WAITING_FOR_CODEC. 150 // |state_| is no longer WAITING_FOR_CODEC.
144 void ConfigureMediaCodecAsynchronously(); 151 void ConfigureMediaCodecAsynchronously();
145 152
146 // Like ConfigureMediaCodecAsynchronously, but synchronous. Will NotifyError 153 // Like ConfigureMediaCodecAsynchronously, but synchronous. Will NotifyError
147 // on failure. Since all configuration is done synchronously, there is no 154 // on failure. Since all configuration is done synchronously, there is no
148 // concern with modifying |codec_config_| after this returns. 155 // concern with modifying |codec_config_| after this returns.
149 void ConfigureMediaCodecSynchronously(); 156 void ConfigureMediaCodecSynchronously();
150 157
151 // Instantiate a media codec using |codec_config|.
152 // This may be called on any thread.
153 static std::unique_ptr<MediaCodecBridge> ConfigureMediaCodecOnAnyThread(
154 scoped_refptr<CodecConfig> codec_config);
155
156 // Sends the decoded frame specified by |codec_buffer_index| to the client. 158 // Sends the decoded frame specified by |codec_buffer_index| to the client.
157 void SendDecodedFrameToClient(int32_t codec_buffer_index, 159 void SendDecodedFrameToClient(int32_t codec_buffer_index,
158 int32_t bitstream_id); 160 int32_t bitstream_id);
159 161
160 // Does pending IO tasks if any. Once this is called, it polls |media_codec_| 162 // Does pending IO tasks if any. Once this is called, it polls |media_codec_|
161 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is 163 // until it finishes pending tasks. For the polling, |kDecodePollDelay| is
162 // used. 164 // used.
163 void DoIOTask(bool start_timer); 165 void DoIOTask(bool start_timer);
164 166
165 // Feeds buffers in |pending_bitstream_records_| to |media_codec_|. Returns 167 // Feeds buffers in |pending_bitstream_records_| to |media_codec_|. Returns
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 382
381 // WeakPtrFactory for posting tasks back to |this|. 383 // WeakPtrFactory for posting tasks back to |this|.
382 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; 384 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;
383 385
384 friend class AndroidVideoDecodeAcceleratorTest; 386 friend class AndroidVideoDecodeAcceleratorTest;
385 }; 387 };
386 388
387 } // namespace media 389 } // namespace media
388 390
389 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 391 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698