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