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

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

Issue 2011653002: Close bitstream buffer shared memory handles on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SURFACE_DESTROYED, 169 SURFACE_DESTROYED,
170 }; 170 };
171 171
172 enum DrainType { 172 enum DrainType {
173 DRAIN_TYPE_NONE, 173 DRAIN_TYPE_NONE,
174 DRAIN_FOR_FLUSH, 174 DRAIN_FOR_FLUSH,
175 DRAIN_FOR_RESET, 175 DRAIN_FOR_RESET,
176 DRAIN_FOR_DESTROY, 176 DRAIN_FOR_DESTROY,
177 }; 177 };
178 178
179 // Notification options for ClearPendingBitstreamBuffers()
180 enum BitstreamBufferNotificationType {
181 DONT_NOTIFY_CLIENT = 0,
182 NOTIFY_CLIENT = 1
183 };
184
179 // Configuration info for MediaCodec. 185 // Configuration info for MediaCodec.
180 // This is used to shuttle configuration info between threads without needing 186 // This is used to shuttle configuration info between threads without needing
181 // to worry about the lifetime of the AVDA instance. All of these should not 187 // to worry about the lifetime of the AVDA instance. All of these should not
182 // be modified while |state_| is WAITING_FOR_CODEC. 188 // be modified while |state_| is WAITING_FOR_CODEC.
183 class CodecConfig : public base::RefCountedThreadSafe<CodecConfig> { 189 class CodecConfig : public base::RefCountedThreadSafe<CodecConfig> {
184 public: 190 public:
185 CodecConfig(); 191 CodecConfig();
186 192
187 // Codec type. Used when we configure media codec. 193 // Codec type. Used when we configure media codec.
188 media::VideoCodec codec_ = media::kUnknownVideoCodec; 194 media::VideoCodec codec_ = media::kUnknownVideoCodec;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // (e.g. queued BitstreamBuffers) is not reset, as input following an EOS 340 // (e.g. queued BitstreamBuffers) is not reset, as input following an EOS
335 // is still valid and should be processed. Upon competion calls |done_cb| that 341 // is still valid and should be processed. Upon competion calls |done_cb| that
336 // can be a null callback. 342 // can be a null callback.
337 void ResetCodecState(const base::Closure& done_cb); 343 void ResetCodecState(const base::Closure& done_cb);
338 344
339 // Registered to be called when surfaces are being destroyed. If |surface_id| 345 // Registered to be called when surfaces are being destroyed. If |surface_id|
340 // is our surface, we should release the MediaCodec before returning from 346 // is our surface, we should release the MediaCodec before returning from
341 // this. 347 // this.
342 void OnDestroyingSurface(int surface_id); 348 void OnDestroyingSurface(int surface_id);
343 349
350 // Clear any pending bitstream buffers. This will close any shared memory
351 // handles, and, if |notify| is NOTIFY_CLIENT, notify the client that we're
352 // done with the buffer.
353 void ClearPendingBitstreamBuffers(BitstreamBufferNotificationType notify);
354
344 // Return true if and only if we should use deferred rendering. 355 // Return true if and only if we should use deferred rendering.
345 static bool UseDeferredRenderingStrategy( 356 static bool UseDeferredRenderingStrategy(
346 const gpu::GpuPreferences& gpu_preferences); 357 const gpu::GpuPreferences& gpu_preferences);
347 358
348 // Used to DCHECK that we are called on the correct thread. 359 // Used to DCHECK that we are called on the correct thread.
349 base::ThreadChecker thread_checker_; 360 base::ThreadChecker thread_checker_;
350 361
351 // To expose client callbacks from VideoDecodeAccelerator. 362 // To expose client callbacks from VideoDecodeAccelerator.
352 Client* client_; 363 Client* client_;
353 364
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 452
442 // WeakPtrFactory for posting tasks back to |this|. 453 // WeakPtrFactory for posting tasks back to |this|.
443 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; 454 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;
444 455
445 friend class AndroidVideoDecodeAcceleratorTest; 456 friend class AndroidVideoDecodeAcceleratorTest;
446 }; 457 };
447 458
448 } // namespace media 459 } // namespace media
449 460
450 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 461 #endif // MEDIA_GPU_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | media/gpu/android_video_decode_accelerator.cc » ('j') | media/gpu/android_video_decode_accelerator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698