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

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

Issue 2345123002: Attach color space information to hardware decoded NV12 video frames. (Closed)
Patch Set: comments addressed + compile fixes Created 4 years, 3 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 "media/gpu/dxva_video_decode_accelerator_win.h" 5 #include "media/gpu/dxva_video_decode_accelerator_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #if !defined(OS_WIN) 9 #if !defined(OS_WIN)
10 #error This file should only be built on Windows. 10 #error This file should only be built on Windows.
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 config_changed_ = true; 451 config_changed_ = true;
452 } else { 452 } else {
453 pending_config_changed_ = true; 453 pending_config_changed_ = true;
454 } 454 }
455 } 455 }
456 last_pps_.swap(pps); 456 last_pps_.swap(pps);
457 } 457 }
458 return true; 458 return true;
459 } 459 }
460 460
461 gfx::ColorSpace H264ConfigChangeDetector::current_color_space() const {
462 // TODO(hubbe): Is using last_sps_id_ correct here?
sandersd (OOO until July 31) 2016/09/16 21:54:13 There could be a gap between the ID changing and t
hubbe 2016/09/21 22:04:26 Updated the code to handle this (more) correctly.
463 const H264SPS* sps = parser_->GetSPS(last_sps_id_);
464 if (sps)
465 return sps->GetColorSpace();
466 return gfx::ColorSpace();
467 }
461 468
462 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( 469 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo(
463 int32_t buffer_id, 470 int32_t buffer_id,
464 IMFSample* sample) 471 IMFSample* sample)
465 : input_buffer_id(buffer_id), picture_buffer_id(-1) { 472 : input_buffer_id(buffer_id), picture_buffer_id(-1) {
466 output_sample.Attach(sample); 473 output_sample.Attach(sample);
467 } 474 }
468 475
469 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( 476 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo(
470 const PendingSampleInfo& other) = default; 477 const PendingSampleInfo& other) = default;
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 provide_nv12_textures ? 2 : 1, gfx::Size(width, height), 1893 provide_nv12_textures ? 2 : 1, gfx::Size(width, height),
1887 provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D); 1894 provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D);
1888 } 1895 }
1889 } 1896 }
1890 1897
1891 void DXVAVideoDecodeAccelerator::NotifyPictureReady(int picture_buffer_id, 1898 void DXVAVideoDecodeAccelerator::NotifyPictureReady(int picture_buffer_id,
1892 int input_buffer_id) { 1899 int input_buffer_id) {
1893 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1900 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1894 // This task could execute after the decoder has been torn down. 1901 // This task could execute after the decoder has been torn down.
1895 if (GetState() != kUninitialized && client_) { 1902 if (GetState() != kUninitialized && client_) {
1903 gfx::ColorSpace color_space;
1904 if (share_nv12_textures_ || copy_nv12_textures_) {
1905 // Color space information is only valid for NV12 textures.
1906 // If the texture has been converted to RGB, we don't actually know what
1907 // Color space the output is in.
1908 color_space = config_change_detector_->current_color_space();
1909 }
1896 // TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use 1910 // TODO(henryhsu): Use correct visible size instead of (0, 0). We can't use
1897 // coded size here so use (0, 0) intentionally to have the client choose. 1911 // coded size here so use (0, 0) intentionally to have the client choose.
1898 Picture picture(picture_buffer_id, input_buffer_id, gfx::Rect(0, 0), false); 1912 Picture picture(picture_buffer_id, input_buffer_id, gfx::Rect(0, 0),
1913 color_space, false);
1899 client_->PictureReady(picture); 1914 client_->PictureReady(picture);
1900 } 1915 }
1901 } 1916 }
1902 1917
1903 void DXVAVideoDecodeAccelerator::NotifyInputBuffersDropped() { 1918 void DXVAVideoDecodeAccelerator::NotifyInputBuffersDropped() {
1904 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1919 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1905 if (!client_) 1920 if (!client_)
1906 return; 1921 return;
1907 1922
1908 for (PendingInputs::iterator it = pending_input_buffers_.begin(); 1923 for (PendingInputs::iterator it = pending_input_buffers_.begin();
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 SetState(kConfigChange); 2700 SetState(kConfigChange);
2686 Invalidate(); 2701 Invalidate();
2687 Initialize(config_, client_); 2702 Initialize(config_, client_);
2688 decoder_thread_task_runner_->PostTask( 2703 decoder_thread_task_runner_->PostTask(
2689 FROM_HERE, 2704 FROM_HERE,
2690 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2705 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2691 base::Unretained(this))); 2706 base::Unretained(this)));
2692 } 2707 }
2693 2708
2694 } // namespace media 2709 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698