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

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: compile fix Created 4 years, 2 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?
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 const gfx::ColorSpace& color_space)
473 : input_buffer_id(buffer_id),
474 picture_buffer_id(-1),
475 color_space(color_space) {
466 output_sample.Attach(sample); 476 output_sample.Attach(sample);
467 } 477 }
468 478
469 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( 479 DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo(
470 const PendingSampleInfo& other) = default; 480 const PendingSampleInfo& other) = default;
471 481
472 DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {} 482 DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {}
473 483
474 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( 484 DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
475 const GetGLContextCallback& get_gl_context_cb, 485 const GetGLContextCallback& get_gl_context_cb,
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 DVLOG(1) << "Flags: " << std::hex << std::showbase 1597 DVLOG(1) << "Flags: " << std::hex << std::showbase
1588 << output_stream_info_.dwFlags; 1598 << output_stream_info_.dwFlags;
1589 if (codec_ == kCodecH264) { 1599 if (codec_ == kCodecH264) {
1590 CHECK_EQ(output_stream_info_.dwFlags, 0x107u); 1600 CHECK_EQ(output_stream_info_.dwFlags, 0x107u);
1591 } 1601 }
1592 DVLOG(1) << "Min buffer size: " << output_stream_info_.cbSize; 1602 DVLOG(1) << "Min buffer size: " << output_stream_info_.cbSize;
1593 DVLOG(1) << "Alignment: " << output_stream_info_.cbAlignment; 1603 DVLOG(1) << "Alignment: " << output_stream_info_.cbAlignment;
1594 return true; 1604 return true;
1595 } 1605 }
1596 1606
1597 void DXVAVideoDecodeAccelerator::DoDecode() { 1607 void DXVAVideoDecodeAccelerator::DoDecode(const gfx::ColorSpace& color_space) {
jbauman 2016/09/23 00:55:25 Another idea would be to get the color space from
hubbe 2016/09/23 04:43:01 Not a bad idea, but MS enum doesn't seem to contai
1598 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::DoDecode"); 1608 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::DoDecode");
1599 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); 1609 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread());
1600 // This function is also called from FlushInternal in a loop which could 1610 // This function is also called from FlushInternal in a loop which could
1601 // result in the state transitioning to kStopped due to no decoded output. 1611 // result in the state transitioning to kStopped due to no decoded output.
1602 State state = GetState(); 1612 State state = GetState();
1603 RETURN_AND_NOTIFY_ON_FAILURE( 1613 RETURN_AND_NOTIFY_ON_FAILURE(
1604 (state == kNormal || state == kFlushing || state == kStopped), 1614 (state == kNormal || state == kFlushing || state == kStopped),
1605 "DoDecode: not in normal/flushing/stopped state", ILLEGAL_STATE, ); 1615 "DoDecode: not in normal/flushing/stopped state", ILLEGAL_STATE, );
1606 1616
1607 MFT_OUTPUT_DATA_BUFFER output_data_buffer = {0}; 1617 MFT_OUTPUT_DATA_BUFFER output_data_buffer = {0};
1608 DWORD status = 0; 1618 DWORD status = 0;
1609
1610 HRESULT hr = decoder_->ProcessOutput(0, // No flags 1619 HRESULT hr = decoder_->ProcessOutput(0, // No flags
1611 1, // # of out streams to pull from 1620 1, // # of out streams to pull from
1612 &output_data_buffer, &status); 1621 &output_data_buffer, &status);
1613 IMFCollection* events = output_data_buffer.pEvents; 1622 IMFCollection* events = output_data_buffer.pEvents;
1614 if (events != NULL) { 1623 if (events != NULL) {
1615 DVLOG(1) << "Got events from ProcessOuput, but discarding"; 1624 DVLOG(1) << "Got events from ProcessOuput, but discarding";
1616 events->Release(); 1625 events->Release();
1617 } 1626 }
1618 if (FAILED(hr)) { 1627 if (FAILED(hr)) {
1619 // A stream change needs further ProcessInput calls to get back decoder 1628 // A stream change needs further ProcessInput calls to get back decoder
1620 // output which is why we need to set the state to stopped. 1629 // output which is why we need to set the state to stopped.
1621 if (hr == MF_E_TRANSFORM_STREAM_CHANGE) { 1630 if (hr == MF_E_TRANSFORM_STREAM_CHANGE) {
1622 if (!SetDecoderOutputMediaType(MFVideoFormat_NV12) && 1631 if (!SetDecoderOutputMediaType(MFVideoFormat_NV12) &&
1623 !SetDecoderOutputMediaType(MFVideoFormat_P010)) { 1632 !SetDecoderOutputMediaType(MFVideoFormat_P010)) {
1624 // Decoder didn't let us set NV12 output format. Not sure as to why 1633 // Decoder didn't let us set NV12 output format. Not sure as to why
1625 // this can happen. Give up in disgust. 1634 // this can happen. Give up in disgust.
1626 NOTREACHED() << "Failed to set decoder output media type to NV12"; 1635 NOTREACHED() << "Failed to set decoder output media type to NV12";
1627 SetState(kStopped); 1636 SetState(kStopped);
1628 } else { 1637 } else {
1629 DVLOG(1) << "Received output format change from the decoder." 1638 DVLOG(1) << "Received output format change from the decoder."
1630 " Recursively invoking DoDecode"; 1639 " Recursively invoking DoDecode";
1631 DoDecode(); 1640 DoDecode(color_space);
1632 } 1641 }
1633 return; 1642 return;
1634 } else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) { 1643 } else if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT) {
1635 // No more output from the decoder. Stop playback. 1644 // No more output from the decoder. Stop playback.
1636 SetState(kStopped); 1645 SetState(kStopped);
1637 return; 1646 return;
1638 } else { 1647 } else {
1639 NOTREACHED() << "Unhandled error in DoDecode()"; 1648 NOTREACHED() << "Unhandled error in DoDecode()";
1640 return; 1649 return;
1641 } 1650 }
1642 } 1651 }
1643 TRACE_EVENT_ASYNC_END0("gpu", "DXVAVideoDecodeAccelerator.Decoding", this); 1652 TRACE_EVENT_ASYNC_END0("gpu", "DXVAVideoDecodeAccelerator.Decoding", this);
1644 1653
1645 TRACE_COUNTER1("DXVA Decoding", "TotalPacketsBeforeDecode", 1654 TRACE_COUNTER1("DXVA Decoding", "TotalPacketsBeforeDecode",
1646 inputs_before_decode_); 1655 inputs_before_decode_);
1647 1656
1648 inputs_before_decode_ = 0; 1657 inputs_before_decode_ = 0;
1649 1658
1650 RETURN_AND_NOTIFY_ON_FAILURE(ProcessOutputSample(output_data_buffer.pSample), 1659 RETURN_AND_NOTIFY_ON_FAILURE(
1651 "Failed to process output sample.", 1660 ProcessOutputSample(output_data_buffer.pSample, color_space),
1652 PLATFORM_FAILURE, ); 1661 "Failed to process output sample.", PLATFORM_FAILURE, );
1653 } 1662 }
1654 1663
1655 bool DXVAVideoDecodeAccelerator::ProcessOutputSample(IMFSample* sample) { 1664 bool DXVAVideoDecodeAccelerator::ProcessOutputSample(
1665 IMFSample* sample,
1666 const gfx::ColorSpace& color_space) {
1656 RETURN_ON_FAILURE(sample, "Decode succeeded with NULL output sample", false); 1667 RETURN_ON_FAILURE(sample, "Decode succeeded with NULL output sample", false);
1657 1668
1658 LONGLONG input_buffer_id = 0; 1669 LONGLONG input_buffer_id = 0;
1659 RETURN_ON_HR_FAILURE(sample->GetSampleTime(&input_buffer_id), 1670 RETURN_ON_HR_FAILURE(sample->GetSampleTime(&input_buffer_id),
1660 "Failed to get input buffer id associated with sample", 1671 "Failed to get input buffer id associated with sample",
1661 false); 1672 false);
1662 1673
1663 { 1674 {
1664 base::AutoLock lock(decoder_lock_); 1675 base::AutoLock lock(decoder_lock_);
1665 DCHECK(pending_output_samples_.empty()); 1676 DCHECK(pending_output_samples_.empty());
1666 pending_output_samples_.push_back( 1677 pending_output_samples_.push_back(
1667 PendingSampleInfo(input_buffer_id, sample)); 1678 PendingSampleInfo(input_buffer_id, sample, color_space));
1668 } 1679 }
1669 1680
1670 if (pictures_requested_) { 1681 if (pictures_requested_) {
1671 DVLOG(1) << "Waiting for picture slots from the client."; 1682 DVLOG(1) << "Waiting for picture slots from the client.";
1672 main_thread_task_runner_->PostTask( 1683 main_thread_task_runner_->PostTask(
1673 FROM_HERE, 1684 FROM_HERE,
1674 base::Bind(&DXVAVideoDecodeAccelerator::ProcessPendingSamples, 1685 base::Bind(&DXVAVideoDecodeAccelerator::ProcessPendingSamples,
1675 weak_this_factory_.GetWeakPtr())); 1686 weak_this_factory_.GetWeakPtr()));
1676 return true; 1687 return true;
1677 } 1688 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 } 1739 }
1729 1740
1730 if (width != index->second->size().width() || 1741 if (width != index->second->size().width() ||
1731 height != index->second->size().height()) { 1742 height != index->second->size().height()) {
1732 HandleResolutionChanged(width, height); 1743 HandleResolutionChanged(width, height);
1733 return; 1744 return;
1734 } 1745 }
1735 1746
1736 pending_sample->picture_buffer_id = index->second->id(); 1747 pending_sample->picture_buffer_id = index->second->id();
1737 index->second->set_bound(); 1748 index->second->set_bound();
1749 index->second->set_color_space(pending_sample->color_space);
1738 if (share_nv12_textures_) { 1750 if (share_nv12_textures_) {
1739 main_thread_task_runner_->PostTask( 1751 main_thread_task_runner_->PostTask(
1740 FROM_HERE, 1752 FROM_HERE,
1741 base::Bind(&DXVAVideoDecodeAccelerator::BindPictureBufferToSample, 1753 base::Bind(&DXVAVideoDecodeAccelerator::BindPictureBufferToSample,
1742 weak_this_factory_.GetWeakPtr(), 1754 weak_this_factory_.GetWeakPtr(),
1743 pending_sample->output_sample, 1755 pending_sample->output_sample,
1744 pending_sample->picture_buffer_id, 1756 pending_sample->picture_buffer_id,
1745 pending_sample->input_buffer_id)); 1757 pending_sample->input_buffer_id));
1746 continue; 1758 continue;
1747 } 1759 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 // they need to be GL_TEXTURE_EXTERNAL_OES. 1893 // they need to be GL_TEXTURE_EXTERNAL_OES.
1882 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_; 1894 bool provide_nv12_textures = share_nv12_textures_ || copy_nv12_textures_;
1883 client_->ProvidePictureBuffers( 1895 client_->ProvidePictureBuffers(
1884 kNumPictureBuffers, 1896 kNumPictureBuffers,
1885 provide_nv12_textures ? PIXEL_FORMAT_NV12 : PIXEL_FORMAT_UNKNOWN, 1897 provide_nv12_textures ? PIXEL_FORMAT_NV12 : PIXEL_FORMAT_UNKNOWN,
1886 provide_nv12_textures ? 2 : 1, gfx::Size(width, height), 1898 provide_nv12_textures ? 2 : 1, gfx::Size(width, height),
1887 provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D); 1899 provide_nv12_textures ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D);
1888 } 1900 }
1889 } 1901 }
1890 1902
1891 void DXVAVideoDecodeAccelerator::NotifyPictureReady(int picture_buffer_id, 1903 void DXVAVideoDecodeAccelerator::NotifyPictureReady(
1892 int input_buffer_id) { 1904 int picture_buffer_id,
1905 int input_buffer_id,
1906 const gfx::ColorSpace& color_space) {
1893 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); 1907 DCHECK(main_thread_task_runner_->BelongsToCurrentThread());
1894 // This task could execute after the decoder has been torn down. 1908 // This task could execute after the decoder has been torn down.
1895 if (GetState() != kUninitialized && client_) { 1909 if (GetState() != kUninitialized && client_) {
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 RETURN_AND_NOTIFY_ON_FAILURE(SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0), 1982 RETURN_AND_NOTIFY_ON_FAILURE(SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0),
1968 "Failed to send drain message", 1983 "Failed to send drain message",
1969 PLATFORM_FAILURE, ); 1984 PLATFORM_FAILURE, );
1970 sent_drain_message_ = true; 1985 sent_drain_message_ = true;
1971 } 1986 }
1972 } 1987 }
1973 1988
1974 // Attempt to retrieve an output frame from the decoder. If we have one, 1989 // Attempt to retrieve an output frame from the decoder. If we have one,
1975 // return and proceed when the output frame is processed. If we don't have a 1990 // return and proceed when the output frame is processed. If we don't have a
1976 // frame then we are done. 1991 // frame then we are done.
1977 DoDecode(); 1992 DoDecode(config_change_detector_->current_color_space());
1978 if (OutputSamplesPresent()) 1993 if (OutputSamplesPresent())
1979 return; 1994 return;
1980 1995
1981 if (!processing_config_changed_) { 1996 if (!processing_config_changed_) {
1982 SetState(kFlushing); 1997 SetState(kFlushing);
1983 1998
1984 main_thread_task_runner_->PostTask( 1999 main_thread_task_runner_->PostTask(
1985 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::NotifyFlushDone, 2000 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::NotifyFlushDone,
1986 weak_this_factory_.GetWeakPtr())); 2001 weak_this_factory_.GetWeakPtr()));
1987 } else { 2002 } else {
(...skipping 28 matching lines...) Expand all
2016 PLATFORM_FAILURE, ); 2031 PLATFORM_FAILURE, );
2017 2032
2018 processing_config_changed_ = config_changed; 2033 processing_config_changed_ = config_changed;
2019 2034
2020 if (config_changed) { 2035 if (config_changed) {
2021 pending_input_buffers_.push_back(sample); 2036 pending_input_buffers_.push_back(sample);
2022 FlushInternal(); 2037 FlushInternal();
2023 return; 2038 return;
2024 } 2039 }
2025 2040
2041 gfx::ColorSpace color_space = config_change_detector_->current_color_space();
2042
2026 if (!inputs_before_decode_) { 2043 if (!inputs_before_decode_) {
2027 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding", 2044 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding",
2028 this); 2045 this);
2029 } 2046 }
2030 inputs_before_decode_++; 2047 inputs_before_decode_++;
2031 2048
2032 hr = decoder_->ProcessInput(0, sample.get(), 0); 2049 hr = decoder_->ProcessInput(0, sample.get(), 0);
2033 // As per msdn if the decoder returns MF_E_NOTACCEPTING then it means that it 2050 // As per msdn if the decoder returns MF_E_NOTACCEPTING then it means that it
2034 // has enough data to produce one or more output samples. In this case the 2051 // has enough data to produce one or more output samples. In this case the
2035 // recommended options are to 2052 // recommended options are to
2036 // 1. Generate new output by calling IMFTransform::ProcessOutput until it 2053 // 1. Generate new output by calling IMFTransform::ProcessOutput until it
2037 // returns MF_E_TRANSFORM_NEED_MORE_INPUT. 2054 // returns MF_E_TRANSFORM_NEED_MORE_INPUT.
2038 // 2. Flush the input data 2055 // 2. Flush the input data
2039 // We implement the first option, i.e to retrieve the output sample and then 2056 // We implement the first option, i.e to retrieve the output sample and then
2040 // process the input again. Failure in either of these steps is treated as a 2057 // process the input again. Failure in either of these steps is treated as a
2041 // decoder failure. 2058 // decoder failure.
2042 if (hr == MF_E_NOTACCEPTING) { 2059 if (hr == MF_E_NOTACCEPTING) {
2043 DoDecode(); 2060 DoDecode(color_space);
2044 // If the DoDecode call resulted in an output frame then we should not 2061 // If the DoDecode call resulted in an output frame then we should not
2045 // process any more input until that frame is copied to the target surface. 2062 // process any more input until that frame is copied to the target surface.
2046 if (!OutputSamplesPresent()) { 2063 if (!OutputSamplesPresent()) {
2047 State state = GetState(); 2064 State state = GetState();
2048 RETURN_AND_NOTIFY_ON_FAILURE( 2065 RETURN_AND_NOTIFY_ON_FAILURE(
2049 (state == kStopped || state == kNormal || state == kFlushing), 2066 (state == kStopped || state == kNormal || state == kFlushing),
2050 "Failed to process output. Unexpected decoder state: " << state, 2067 "Failed to process output. Unexpected decoder state: " << state,
2051 PLATFORM_FAILURE, ); 2068 PLATFORM_FAILURE, );
2052 hr = decoder_->ProcessInput(0, sample.get(), 0); 2069 hr = decoder_->ProcessInput(0, sample.get(), 0);
2053 } 2070 }
(...skipping 11 matching lines...) Expand all
2065 decoder_thread_task_runner_->PostTask( 2082 decoder_thread_task_runner_->PostTask(
2066 FROM_HERE, 2083 FROM_HERE,
2067 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2084 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2068 base::Unretained(this))); 2085 base::Unretained(this)));
2069 return; 2086 return;
2070 } 2087 }
2071 } 2088 }
2072 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to process input sample", 2089 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to process input sample",
2073 PLATFORM_FAILURE, ); 2090 PLATFORM_FAILURE, );
2074 2091
2075 DoDecode(); 2092 DoDecode(color_space);
2076 2093
2077 State state = GetState(); 2094 State state = GetState();
2078 RETURN_AND_NOTIFY_ON_FAILURE( 2095 RETURN_AND_NOTIFY_ON_FAILURE(
2079 (state == kStopped || state == kNormal || state == kFlushing), 2096 (state == kStopped || state == kNormal || state == kFlushing),
2080 "Failed to process output. Unexpected decoder state: " << state, 2097 "Failed to process output. Unexpected decoder state: " << state,
2081 ILLEGAL_STATE, ); 2098 ILLEGAL_STATE, );
2082 2099
2083 LONGLONG input_buffer_id = 0; 2100 LONGLONG input_buffer_id = 0;
2084 RETURN_ON_HR_FAILURE( 2101 RETURN_ON_HR_FAILURE(
2085 sample->GetSampleTime(&input_buffer_id), 2102 sample->GetSampleTime(&input_buffer_id),
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), 2263 RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(),
2247 "Failed to make context current", 2264 "Failed to make context current",
2248 PLATFORM_FAILURE, ); 2265 PLATFORM_FAILURE, );
2249 2266
2250 DCHECK(!output_picture_buffers_.empty()); 2267 DCHECK(!output_picture_buffers_.empty());
2251 2268
2252 bool result = picture_buffer->CopySurfaceComplete(src_surface, dest_surface); 2269 bool result = picture_buffer->CopySurfaceComplete(src_surface, dest_surface);
2253 RETURN_AND_NOTIFY_ON_FAILURE(result, "Failed to complete copying surface", 2270 RETURN_AND_NOTIFY_ON_FAILURE(result, "Failed to complete copying surface",
2254 PLATFORM_FAILURE, ); 2271 PLATFORM_FAILURE, );
2255 2272
2256 NotifyPictureReady(picture_buffer->id(), input_buffer_id); 2273 NotifyPictureReady(picture_buffer->id(), input_buffer_id, gfx::ColorSpace());
2257 2274
2258 { 2275 {
2259 base::AutoLock lock(decoder_lock_); 2276 base::AutoLock lock(decoder_lock_);
2260 if (!pending_output_samples_.empty()) 2277 if (!pending_output_samples_.empty())
2261 pending_output_samples_.pop_front(); 2278 pending_output_samples_.pop_front();
2262 } 2279 }
2263 2280
2264 if (pending_flush_ || processing_config_changed_) { 2281 if (pending_flush_ || processing_config_changed_) {
2265 decoder_thread_task_runner_->PostTask( 2282 decoder_thread_task_runner_->PostTask(
2266 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, 2283 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2298 RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), 2315 RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(),
2299 "Failed to make context current", 2316 "Failed to make context current",
2300 PLATFORM_FAILURE, ); 2317 PLATFORM_FAILURE, );
2301 2318
2302 DCHECK(!output_picture_buffers_.empty()); 2319 DCHECK(!output_picture_buffers_.empty());
2303 2320
2304 bool result = picture_buffer->BindSampleToTexture(sample); 2321 bool result = picture_buffer->BindSampleToTexture(sample);
2305 RETURN_AND_NOTIFY_ON_FAILURE(result, "Failed to complete copying surface", 2322 RETURN_AND_NOTIFY_ON_FAILURE(result, "Failed to complete copying surface",
2306 PLATFORM_FAILURE, ); 2323 PLATFORM_FAILURE, );
2307 2324
2308 NotifyPictureReady(picture_buffer->id(), input_buffer_id); 2325 NotifyPictureReady(picture_buffer->id(), input_buffer_id,
2326 picture_buffer->color_space());
2309 2327
2310 { 2328 {
2311 base::AutoLock lock(decoder_lock_); 2329 base::AutoLock lock(decoder_lock_);
2312 if (!pending_output_samples_.empty()) 2330 if (!pending_output_samples_.empty())
2313 pending_output_samples_.pop_front(); 2331 pending_output_samples_.pop_front();
2314 } 2332 }
2315 2333
2316 if (pending_flush_ || processing_config_changed_) { 2334 if (pending_flush_ || processing_config_changed_) {
2317 decoder_thread_task_runner_->PostTask( 2335 decoder_thread_task_runner_->PostTask(
2318 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, 2336 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal,
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 SetState(kConfigChange); 2703 SetState(kConfigChange);
2686 Invalidate(); 2704 Invalidate();
2687 Initialize(config_, client_); 2705 Initialize(config_, client_);
2688 decoder_thread_task_runner_->PostTask( 2706 decoder_thread_task_runner_->PostTask(
2689 FROM_HERE, 2707 FROM_HERE,
2690 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, 2708 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers,
2691 base::Unretained(this))); 2709 base::Unretained(this)));
2692 } 2710 }
2693 2711
2694 } // namespace media 2712 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698