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

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

Issue 1892013002: ReleaseOutputBuffer to surface back and front buffers where possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanerer. Created 4 years, 8 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 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 <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 // Return the GL texture target that the PictureBuffer textures use. 69 // Return the GL texture target that the PictureBuffer textures use.
70 virtual uint32_t GetTextureTarget() const = 0; 70 virtual uint32_t GetTextureTarget() const = 0;
71 71
72 // Return the size to use when requesting picture buffers. 72 // Return the size to use when requesting picture buffers.
73 virtual gfx::Size GetPictureBufferSize() const = 0; 73 virtual gfx::Size GetPictureBufferSize() const = 0;
74 74
75 // Make the provided PictureBuffer draw the image that is represented by 75 // Make the provided PictureBuffer draw the image that is represented by
76 // the decoded output buffer at codec_buffer_index. 76 // the decoded output buffer at codec_buffer_index.
77 virtual void UseCodecBufferForPictureBuffer( 77 virtual void UseCodecBufferForPictureBuffer(
78 int32_t codec_buffer_index, 78 int32_t codec_buffer_index,
79 const media::PictureBuffer& picture_buffer) = 0; 79 const media::PictureBuffer& picture_buffer,
80 const std::vector<int32_t>& pictures_out_for_display) = 0;
liberato (no reviews please) 2016/04/22 00:51:05 couldn't pictures_out_for_display be an implementa
DaleCurtis 2016/04/22 01:33:58 Great suggestion. Done.
80 81
81 // Notify strategy that a picture buffer has been assigned. 82 // Notify strategy that a picture buffer has been assigned.
82 virtual void AssignOnePictureBuffer( 83 virtual void AssignOnePictureBuffer(
83 const media::PictureBuffer& picture_buffer, 84 const media::PictureBuffer& picture_buffer,
84 bool have_context) {} 85 bool have_context) {}
85 86
86 // Notify strategy that a picture buffer has been reused. 87 // Notify strategy that a picture buffer has been reused.
87 virtual void ReuseOnePictureBuffer( 88 virtual void ReuseOnePictureBuffer(
88 const media::PictureBuffer& picture_buffer) {} 89 const media::PictureBuffer& picture_buffer,
90 const std::vector<int32_t>& pictures_out_for_display) {}
91
92 // Attempts to free up codec output buffers by rendering early.
93 virtual void MaybeRenderEarly(
94 const std::vector<int32_t>& pictures_out_for_display) {}
89 95
90 // Notify strategy that we have a new android MediaCodec instance. This 96 // Notify strategy that we have a new android MediaCodec instance. This
91 // happens when we're starting up or re-configuring mid-stream. Any 97 // happens when we're starting up or re-configuring mid-stream. Any
92 // previously provided codec should no longer be referenced. 98 // previously provided codec should no longer be referenced.
93 virtual void CodecChanged(media::VideoCodecBridge* codec) = 0; 99 virtual void CodecChanged(media::VideoCodecBridge* codec) = 0;
94 100
95 // Notify the strategy that a frame is available. This callback can happen 101 // Notify the strategy that a frame is available. This callback can happen
96 // on any thread at any time. 102 // on any thread at any time.
97 virtual void OnFrameAvailable() = 0; 103 virtual void OnFrameAvailable() = 0;
98 104
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 State state_; 316 State state_;
311 317
312 // This map maintains the picture buffers passed to the client for decoding. 318 // This map maintains the picture buffers passed to the client for decoding.
313 // The key is the picture buffer id. 319 // The key is the picture buffer id.
314 OutputBufferMap output_picture_buffers_; 320 OutputBufferMap output_picture_buffers_;
315 321
316 // This keeps the free picture buffer ids which can be used for sending 322 // This keeps the free picture buffer ids which can be used for sending
317 // decoded frames to the client. 323 // decoded frames to the client.
318 std::queue<int32_t> free_picture_ids_; 324 std::queue<int32_t> free_picture_ids_;
319 325
326 // Picture buffer IDs that are out for display. Stored in order of frames as
327 // they are returned from the decoder.
328 std::vector<int32_t> pictures_out_for_display_;
329
320 // The low-level decoder which Android SDK provides. 330 // The low-level decoder which Android SDK provides.
321 std::unique_ptr<media::VideoCodecBridge> media_codec_; 331 std::unique_ptr<media::VideoCodecBridge> media_codec_;
322 332
323 // Set to true after requesting picture buffers to the client. 333 // Set to true after requesting picture buffers to the client.
324 bool picturebuffers_requested_; 334 bool picturebuffers_requested_;
325 335
326 // The resolution of the stream. 336 // The resolution of the stream.
327 gfx::Size size_; 337 gfx::Size size_;
328 338
329 // Encoded bitstream buffers to be passed to media codec, queued until an 339 // Encoded bitstream buffers to be passed to media codec, queued until an
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 392
383 // WeakPtrFactory for posting tasks back to |this|. 393 // WeakPtrFactory for posting tasks back to |this|.
384 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_; 394 base::WeakPtrFactory<AndroidVideoDecodeAccelerator> weak_this_factory_;
385 395
386 friend class AndroidVideoDecodeAcceleratorTest; 396 friend class AndroidVideoDecodeAcceleratorTest;
387 }; 397 };
388 398
389 } // namespace content 399 } // namespace content
390 400
391 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_ 401 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_VIDEO_DECODE_ACCELERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698