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

Side by Side Diff: media/gpu/dxva_picture_buffer_win.cc

Issue 2503063002: media: Inform VideoBlit/MFTransform of video color information (Closed)
Patch Set: comments addressed Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "media/gpu/dxva_picture_buffer_win.h" 5 #include "media/gpu/dxva_picture_buffer_win.h"
6 6
7 #include "media/gpu/dxva_video_decode_accelerator_win.h" 7 #include "media/gpu/dxva_video_decode_accelerator_win.h"
8 #include "third_party/angle/include/EGL/egl.h" 8 #include "third_party/angle/include/EGL/egl.h"
9 #include "third_party/angle/include/EGL/eglext.h" 9 #include "third_party/angle/include/EGL/eglext.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 DCHECK_EQ(BOUND, state_); 286 DCHECK_EQ(BOUND, state_);
287 state_ = COPYING; 287 state_ = COPYING;
288 DCHECK(dest_surface || dx11_texture); 288 DCHECK(dest_surface || dx11_texture);
289 if (dx11_texture) { 289 if (dx11_texture) {
290 // Grab a reference on the decoder texture. This reference will be released 290 // Grab a reference on the decoder texture. This reference will be released
291 // when we receive a notification that the copy was completed or when the 291 // when we receive a notification that the copy was completed or when the
292 // DXVAPictureBuffer instance is destroyed. 292 // DXVAPictureBuffer instance is destroyed.
293 decoder_dx11_texture_ = dx11_texture; 293 decoder_dx11_texture_ = dx11_texture;
294 decoder->CopyTexture(dx11_texture, dx11_decoding_texture_.get(), 294 decoder->CopyTexture(dx11_texture, dx11_decoding_texture_.get(),
295 dx11_keyed_mutex_, keyed_mutex_value_, id(), 295 dx11_keyed_mutex_, keyed_mutex_value_, id(),
296 input_buffer_id); 296 input_buffer_id, color_space_);
297 return true; 297 return true;
298 } 298 }
299 D3DSURFACE_DESC surface_desc; 299 D3DSURFACE_DESC surface_desc;
300 HRESULT hr = dest_surface->GetDesc(&surface_desc); 300 HRESULT hr = dest_surface->GetDesc(&surface_desc);
301 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false); 301 RETURN_ON_HR_FAILURE(hr, "Failed to get surface description", false);
302 302
303 D3DSURFACE_DESC texture_desc; 303 D3DSURFACE_DESC texture_desc;
304 decoding_texture_->GetLevelDesc(0, &texture_desc); 304 decoding_texture_->GetLevelDesc(0, &texture_desc);
305 305
306 if (texture_desc.Width != surface_desc.Width || 306 if (texture_desc.Width != surface_desc.Width ||
(...skipping 15 matching lines...) Expand all
322 // Grab a reference on the decoder surface and the target surface. These 322 // Grab a reference on the decoder surface and the target surface. These
323 // references will be released when we receive a notification that the 323 // references will be released when we receive a notification that the
324 // copy was completed or when the DXVAPictureBuffer instance is destroyed. 324 // copy was completed or when the DXVAPictureBuffer instance is destroyed.
325 // We hold references here as it is easier to manage their lifetimes. 325 // We hold references here as it is easier to manage their lifetimes.
326 hr = decoding_texture_->GetSurfaceLevel(0, target_surface_.Receive()); 326 hr = decoding_texture_->GetSurfaceLevel(0, target_surface_.Receive());
327 RETURN_ON_HR_FAILURE(hr, "Failed to get surface from texture", false); 327 RETURN_ON_HR_FAILURE(hr, "Failed to get surface from texture", false);
328 328
329 decoder_surface_ = dest_surface; 329 decoder_surface_ = dest_surface;
330 330
331 decoder->CopySurface(decoder_surface_.get(), target_surface_.get(), id(), 331 decoder->CopySurface(decoder_surface_.get(), target_surface_.get(), id(),
332 input_buffer_id); 332 input_buffer_id, color_space_);
333 color_space_ = gfx::ColorSpace();
333 return true; 334 return true;
334 } 335 }
335 336
336 gl::GLFence* PbufferPictureBuffer::reuse_fence() { 337 gl::GLFence* PbufferPictureBuffer::reuse_fence() {
337 return reuse_fence_.get(); 338 return reuse_fence_.get();
338 } 339 }
339 340
340 bool PbufferPictureBuffer::CopySurfaceComplete( 341 bool PbufferPictureBuffer::CopySurfaceComplete(
341 IDirect3DSurface9* src_surface, 342 IDirect3DSurface9* src_surface,
342 IDirect3DSurface9* dest_surface) { 343 IDirect3DSurface9* dest_surface) {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 int input_buffer_id) { 605 int input_buffer_id) {
605 DCHECK_EQ(BOUND, state_); 606 DCHECK_EQ(BOUND, state_);
606 state_ = COPYING; 607 state_ = COPYING;
607 DCHECK(dx11_texture); 608 DCHECK(dx11_texture);
608 // Grab a reference on the decoder texture. This reference will be released 609 // Grab a reference on the decoder texture. This reference will be released
609 // when we receive a notification that the copy was completed or when the 610 // when we receive a notification that the copy was completed or when the
610 // DXVAPictureBuffer instance is destroyed. 611 // DXVAPictureBuffer instance is destroyed.
611 dx11_decoding_texture_ = dx11_texture; 612 dx11_decoding_texture_ = dx11_texture;
612 decoder->CopyTexture(dx11_texture, decoder_copy_texture_.get(), 613 decoder->CopyTexture(dx11_texture, decoder_copy_texture_.get(),
613 dx11_keyed_mutex_, keyed_mutex_value_, id(), 614 dx11_keyed_mutex_, keyed_mutex_value_, id(),
614 input_buffer_id); 615 input_buffer_id, color_space_);
615 // The texture copy will acquire the current keyed mutex value and release 616 // The texture copy will acquire the current keyed mutex value and release
616 // with the value + 1. 617 // with the value + 1.
617 keyed_mutex_value_++; 618 keyed_mutex_value_++;
618 return true; 619 return true;
619 } 620 }
620 621
621 bool EGLStreamCopyPictureBuffer::CopySurfaceComplete( 622 bool EGLStreamCopyPictureBuffer::CopySurfaceComplete(
622 IDirect3DSurface9* src_surface, 623 IDirect3DSurface9* src_surface,
623 IDirect3DSurface9* dest_surface) { 624 IDirect3DSurface9* dest_surface) {
624 DCHECK(!src_surface); 625 DCHECK(!src_surface);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 state_ = UNUSED; 660 state_ = UNUSED;
660 661
661 if (stream_) { 662 if (stream_) {
662 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_); 663 EGLBoolean result = eglStreamConsumerReleaseKHR(egl_display, stream_);
663 RETURN_ON_FAILURE(result, "Could not release stream", false); 664 RETURN_ON_FAILURE(result, "Could not release stream", false);
664 } 665 }
665 return true; 666 return true;
666 } 667 }
667 668
668 } // namespace media 669 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698