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

Side by Side Diff: content/common/gpu/media/dxva_video_decode_accelerator_win.cc

Issue 1751323002: Allow multiple texture ids per picture buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h" 5 #include "content/common/gpu/media/dxva_video_decode_accelerator_win.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #error This file should only be built on Windows. 8 #error This file should only be built on Windows.
9 #endif // !defined(OS_WIN) 9 #endif // !defined(OS_WIN)
10 10
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 } 766 }
767 767
768 bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::CopySurfaceComplete( 768 bool DXVAVideoDecodeAccelerator::DXVAPictureBuffer::CopySurfaceComplete(
769 IDirect3DSurface9* src_surface, 769 IDirect3DSurface9* src_surface,
770 IDirect3DSurface9* dest_surface) { 770 IDirect3DSurface9* dest_surface) {
771 DCHECK(!available()); 771 DCHECK(!available());
772 772
773 GLint current_texture = 0; 773 GLint current_texture = 0;
774 glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture); 774 glGetIntegerv(GL_TEXTURE_BINDING_2D, &current_texture);
775 775
776 glBindTexture(GL_TEXTURE_2D, picture_buffer_.texture_id()); 776 glBindTexture(GL_TEXTURE_2D, picture_buffer_.texture_ids()[0]);
777 777
778 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 778 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
779 779
780 if (src_surface && dest_surface) { 780 if (src_surface && dest_surface) {
781 DCHECK_EQ(src_surface, decoder_surface_.get()); 781 DCHECK_EQ(src_surface, decoder_surface_.get());
782 DCHECK_EQ(dest_surface, target_surface_.get()); 782 DCHECK_EQ(dest_surface, target_surface_.get());
783 decoder_surface_.Release(); 783 decoder_surface_.Release();
784 target_surface_.Release(); 784 target_surface_.Release();
785 } else { 785 } else {
786 DCHECK(decoder_dx11_texture_.get()); 786 DCHECK(decoder_dx11_texture_.get());
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 RETURN_AND_NOTIFY_ON_FAILURE((state != kUninitialized), 1140 RETURN_AND_NOTIFY_ON_FAILURE((state != kUninitialized),
1141 "Invalid state: " << state, ILLEGAL_STATE,); 1141 "Invalid state: " << state, ILLEGAL_STATE,);
1142 RETURN_AND_NOTIFY_ON_FAILURE((kNumPictureBuffers >= buffers.size()), 1142 RETURN_AND_NOTIFY_ON_FAILURE((kNumPictureBuffers >= buffers.size()),
1143 "Failed to provide requested picture buffers. (Got " << buffers.size() << 1143 "Failed to provide requested picture buffers. (Got " << buffers.size() <<
1144 ", requested " << kNumPictureBuffers << ")", INVALID_ARGUMENT,); 1144 ", requested " << kNumPictureBuffers << ")", INVALID_ARGUMENT,);
1145 1145
1146 // Copy the picture buffers provided by the client to the available list, 1146 // Copy the picture buffers provided by the client to the available list,
1147 // and mark these buffers as available for use. 1147 // and mark these buffers as available for use.
1148 for (size_t buffer_index = 0; buffer_index < buffers.size(); 1148 for (size_t buffer_index = 0; buffer_index < buffers.size();
1149 ++buffer_index) { 1149 ++buffer_index) {
1150 DCHECK_LE(1u, buffers[buffer_index].texture_ids().size());
1150 linked_ptr<DXVAPictureBuffer> picture_buffer = 1151 linked_ptr<DXVAPictureBuffer> picture_buffer =
1151 DXVAPictureBuffer::Create(*this, buffers[buffer_index], egl_config_); 1152 DXVAPictureBuffer::Create(*this, buffers[buffer_index], egl_config_);
1152 RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer.get(), 1153 RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer.get(),
1153 "Failed to allocate picture buffer", PLATFORM_FAILURE,); 1154 "Failed to allocate picture buffer", PLATFORM_FAILURE,);
1154 1155
1155 bool inserted = output_picture_buffers_.insert(std::make_pair( 1156 bool inserted = output_picture_buffers_.insert(std::make_pair(
1156 buffers[buffer_index].id(), picture_buffer)).second; 1157 buffers[buffer_index].id(), picture_buffer)).second;
1157 DCHECK(inserted); 1158 DCHECK(inserted);
1158 } 1159 }
1159 1160
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 void DXVAVideoDecodeAccelerator::NotifyResetDone() { 1875 void DXVAVideoDecodeAccelerator::NotifyResetDone() {
1875 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1876 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1876 if (client_) 1877 if (client_)
1877 client_->NotifyResetDone(); 1878 client_->NotifyResetDone();
1878 } 1879 }
1879 1880
1880 void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) { 1881 void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) {
1881 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1882 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1882 // This task could execute after the decoder has been torn down. 1883 // This task could execute after the decoder has been torn down.
1883 if (GetState() != kUninitialized && client_) { 1884 if (GetState() != kUninitialized && client_) {
1884 client_->ProvidePictureBuffers( 1885 client_->ProvidePictureBuffers(kNumPictureBuffers, 1,
1885 kNumPictureBuffers, 1886 gfx::Size(width, height), GL_TEXTURE_2D);
1886 gfx::Size(width, height),
1887 GL_TEXTURE_2D);
1888 } 1887 }
1889 } 1888 }
1890 1889
1891 void DXVAVideoDecodeAccelerator::NotifyPictureReady( 1890 void DXVAVideoDecodeAccelerator::NotifyPictureReady(
1892 int picture_buffer_id, 1891 int picture_buffer_id,
1893 int input_buffer_id) { 1892 int input_buffer_id) {
1894 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1893 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1895 // This task could execute after the decoder has been torn down. 1894 // This task could execute after the decoder has been torn down.
1896 if (GetState() != kUninitialized && client_) { 1895 if (GetState() != kUninitialized && client_) {
1897 // TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use 1896 // TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 DismissStaleBuffers(true); 2650 DismissStaleBuffers(true);
2652 Invalidate(); 2651 Invalidate();
2653 Initialize(config_, client_); 2652 Initialize(config_, client_);
2654 decoder_thread_task_runner_->PostTask( 2653 decoder_thread_task_runner_->PostTask(
2655 FROM_HERE, 2654 FROM_HERE,
2656 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2655 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2657 base::Unretained(this))); 2656 base::Unretained(this)));
2658 } 2657 }
2659 2658
2660 } // namespace content 2659 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698