| 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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 codec_(media::kUnknownVideoCodec), | 585 codec_(media::kUnknownVideoCodec), |
| 586 decoder_thread_("DXVAVideoDecoderThread"), | 586 decoder_thread_("DXVAVideoDecoderThread"), |
| 587 pending_flush_(false), | 587 pending_flush_(false), |
| 588 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video), | 588 share_nv12_textures_(gpu_preferences.enable_zero_copy_dxgi_video), |
| 589 use_dx11_(false), | 589 use_dx11_(false), |
| 590 use_keyed_mutex_(false), | 590 use_keyed_mutex_(false), |
| 591 dx11_video_format_converter_media_type_needs_init_(true), | 591 dx11_video_format_converter_media_type_needs_init_(true), |
| 592 using_angle_device_(false), | 592 using_angle_device_(false), |
| 593 enable_accelerated_vpx_decode_( | 593 enable_accelerated_vpx_decode_( |
| 594 gpu_preferences.enable_accelerated_vpx_decode), | 594 gpu_preferences.enable_accelerated_vpx_decode), |
| 595 processing_config_changed_(false), |
| 595 weak_this_factory_(this) { | 596 weak_this_factory_(this) { |
| 596 weak_ptr_ = weak_this_factory_.GetWeakPtr(); | 597 weak_ptr_ = weak_this_factory_.GetWeakPtr(); |
| 597 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); | 598 memset(&input_stream_info_, 0, sizeof(input_stream_info_)); |
| 598 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); | 599 memset(&output_stream_info_, 0, sizeof(output_stream_info_)); |
| 599 } | 600 } |
| 600 | 601 |
| 601 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { | 602 DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
| 602 client_ = NULL; | 603 client_ = NULL; |
| 603 } | 604 } |
| 604 | 605 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 PLATFORM_FAILURE, ); | 921 PLATFORM_FAILURE, ); |
| 921 | 922 |
| 922 bool inserted = | 923 bool inserted = |
| 923 output_picture_buffers_ | 924 output_picture_buffers_ |
| 924 .insert(std::make_pair(buffers[buffer_index].id(), picture_buffer)) | 925 .insert(std::make_pair(buffers[buffer_index].id(), picture_buffer)) |
| 925 .second; | 926 .second; |
| 926 DCHECK(inserted); | 927 DCHECK(inserted); |
| 927 } | 928 } |
| 928 | 929 |
| 929 ProcessPendingSamples(); | 930 ProcessPendingSamples(); |
| 930 if (pending_flush_) { | 931 if (pending_flush_ || processing_config_changed_) { |
| 931 decoder_thread_task_runner_->PostTask( | 932 decoder_thread_task_runner_->PostTask( |
| 932 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, | 933 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, |
| 933 base::Unretained(this))); | 934 base::Unretained(this))); |
| 934 } | 935 } |
| 935 } | 936 } |
| 936 | 937 |
| 937 void DXVAVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_buffer_id) { | 938 void DXVAVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_buffer_id) { |
| 938 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::ReusePictureBuffer"); | 939 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::ReusePictureBuffer"); |
| 939 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 940 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 940 | 941 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 weak_this_factory_.GetWeakPtr(), | 1014 weak_this_factory_.GetWeakPtr(), |
| 1014 picture_buffer_id, count + 1), | 1015 picture_buffer_id, count + 1), |
| 1015 base::TimeDelta::FromMilliseconds(kFlushDecoderSurfaceTimeoutMs)); | 1016 base::TimeDelta::FromMilliseconds(kFlushDecoderSurfaceTimeoutMs)); |
| 1016 return; | 1017 return; |
| 1017 } | 1018 } |
| 1018 RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer->ReusePictureBuffer(), | 1019 RETURN_AND_NOTIFY_ON_FAILURE(picture_buffer->ReusePictureBuffer(), |
| 1019 "Failed to reuse picture buffer", | 1020 "Failed to reuse picture buffer", |
| 1020 PLATFORM_FAILURE, ); | 1021 PLATFORM_FAILURE, ); |
| 1021 | 1022 |
| 1022 ProcessPendingSamples(); | 1023 ProcessPendingSamples(); |
| 1023 if (pending_flush_) { | 1024 if (pending_flush_ || processing_config_changed_) { |
| 1024 decoder_thread_task_runner_->PostTask( | 1025 decoder_thread_task_runner_->PostTask( |
| 1025 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, | 1026 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, |
| 1026 base::Unretained(this))); | 1027 base::Unretained(this))); |
| 1027 } | 1028 } |
| 1028 } | 1029 } |
| 1029 | 1030 |
| 1030 void DXVAVideoDecodeAccelerator::Flush() { | 1031 void DXVAVideoDecodeAccelerator::Flush() { |
| 1031 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1032 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 1032 | 1033 |
| 1033 DVLOG(1) << "DXVAVideoDecodeAccelerator::Flush"; | 1034 DVLOG(1) << "DXVAVideoDecodeAccelerator::Flush"; |
| 1034 | 1035 |
| 1035 State state = GetState(); | 1036 State state = GetState(); |
| 1036 RETURN_AND_NOTIFY_ON_FAILURE((state == kNormal || state == kStopped), | 1037 RETURN_AND_NOTIFY_ON_FAILURE((state == kNormal || state == kStopped), |
| 1037 "Unexpected decoder state: " << state, | 1038 "Unexpected decoder state: " << state, |
| 1038 ILLEGAL_STATE, ); | 1039 ILLEGAL_STATE, ); |
| 1039 | 1040 |
| 1040 SetState(kFlushing); | 1041 SetState(kFlushing); |
| 1041 | 1042 |
| 1042 pending_flush_ = true; | 1043 pending_flush_ = true; |
| 1043 | 1044 |
| 1045 // If we receive a flush while processing a video stream config change, then |
| 1046 // we treat this as a regular flush, i.e we process queued decode packets, |
| 1047 // etc. |
| 1048 // We are resetting the processing_config_changed_ flag here which means that |
| 1049 // we won't be tearing down the decoder instance and recreating it to handle |
| 1050 // the changed configuration. The expectation here is that after the decoder |
| 1051 // is drained it should be able to handle a changed configuration. |
| 1052 // TODO(ananta) |
| 1053 // If a flush is sufficient to get the decoder to process video stream config |
| 1054 // changes correctly, then we don't need to tear down the decoder instance |
| 1055 // and recreate it. Check if this is indeed the case. |
| 1056 processing_config_changed_ = false; |
| 1057 |
| 1044 decoder_thread_task_runner_->PostTask( | 1058 decoder_thread_task_runner_->PostTask( |
| 1045 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, | 1059 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, |
| 1046 base::Unretained(this))); | 1060 base::Unretained(this))); |
| 1047 } | 1061 } |
| 1048 | 1062 |
| 1049 void DXVAVideoDecodeAccelerator::Reset() { | 1063 void DXVAVideoDecodeAccelerator::Reset() { |
| 1050 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1064 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 1051 | 1065 |
| 1052 DVLOG(1) << "DXVAVideoDecodeAccelerator::Reset"; | 1066 DVLOG(1) << "DXVAVideoDecodeAccelerator::Reset"; |
| 1053 | 1067 |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 d3d11_query_.Release(); | 1855 d3d11_query_.Release(); |
| 1842 multi_threaded_.Release(); | 1856 multi_threaded_.Release(); |
| 1843 dx11_video_format_converter_media_type_needs_init_ = true; | 1857 dx11_video_format_converter_media_type_needs_init_ = true; |
| 1844 } else { | 1858 } else { |
| 1845 d3d9_.Release(); | 1859 d3d9_.Release(); |
| 1846 d3d9_device_ex_.Release(); | 1860 d3d9_device_ex_.Release(); |
| 1847 device_manager_.Release(); | 1861 device_manager_.Release(); |
| 1848 query_.Release(); | 1862 query_.Release(); |
| 1849 } | 1863 } |
| 1850 } | 1864 } |
| 1851 | 1865 sent_drain_message_ = false; |
| 1852 SetState(kUninitialized); | 1866 SetState(kUninitialized); |
| 1853 } | 1867 } |
| 1854 | 1868 |
| 1855 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { | 1869 void DXVAVideoDecodeAccelerator::NotifyInputBufferRead(int input_buffer_id) { |
| 1856 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); | 1870 DCHECK(main_thread_task_runner_->BelongsToCurrentThread()); |
| 1857 if (client_) | 1871 if (client_) |
| 1858 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); | 1872 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); |
| 1859 } | 1873 } |
| 1860 | 1874 |
| 1861 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { | 1875 void DXVAVideoDecodeAccelerator::NotifyFlushDone() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 "Failed to get buffer id associated with sample", ); | 1932 "Failed to get buffer id associated with sample", ); |
| 1919 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); | 1933 client_->NotifyEndOfBitstreamBuffer(input_buffer_id); |
| 1920 } | 1934 } |
| 1921 pending_input_buffers_.clear(); | 1935 pending_input_buffers_.clear(); |
| 1922 } | 1936 } |
| 1923 | 1937 |
| 1924 void DXVAVideoDecodeAccelerator::DecodePendingInputBuffers() { | 1938 void DXVAVideoDecodeAccelerator::DecodePendingInputBuffers() { |
| 1925 TRACE_EVENT0("media", | 1939 TRACE_EVENT0("media", |
| 1926 "DXVAVideoDecodeAccelerator::DecodePendingInputBuffers"); | 1940 "DXVAVideoDecodeAccelerator::DecodePendingInputBuffers"); |
| 1927 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 1941 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
| 1942 DCHECK(!processing_config_changed_); |
| 1943 |
| 1928 State state = GetState(); | 1944 State state = GetState(); |
| 1929 RETURN_AND_NOTIFY_ON_FAILURE((state != kUninitialized), | 1945 RETURN_AND_NOTIFY_ON_FAILURE((state != kUninitialized), |
| 1930 "Invalid state: " << state, ILLEGAL_STATE, ); | 1946 "Invalid state: " << state, ILLEGAL_STATE, ); |
| 1931 | 1947 |
| 1932 if (pending_input_buffers_.empty() || OutputSamplesPresent()) | 1948 if (pending_input_buffers_.empty() || OutputSamplesPresent()) |
| 1933 return; | 1949 return; |
| 1934 | 1950 |
| 1935 PendingInputs pending_input_buffers_copy; | 1951 PendingInputs pending_input_buffers_copy; |
| 1936 std::swap(pending_input_buffers_, pending_input_buffers_copy); | 1952 std::swap(pending_input_buffers_, pending_input_buffers_copy); |
| 1937 | 1953 |
| 1938 for (PendingInputs::iterator it = pending_input_buffers_copy.begin(); | 1954 for (PendingInputs::iterator it = pending_input_buffers_copy.begin(); |
| 1939 it != pending_input_buffers_copy.end(); ++it) { | 1955 it != pending_input_buffers_copy.end(); ++it) { |
| 1940 DecodeInternal(*it); | 1956 DecodeInternal(*it); |
| 1941 } | 1957 } |
| 1942 } | 1958 } |
| 1943 | 1959 |
| 1944 void DXVAVideoDecodeAccelerator::FlushInternal() { | 1960 void DXVAVideoDecodeAccelerator::FlushInternal() { |
| 1945 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::FlushInternal"); | 1961 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::FlushInternal"); |
| 1946 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 1962 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
| 1947 | 1963 |
| 1948 // We allow only one output frame to be present at any given time. If we have | 1964 // We allow only one output frame to be present at any given time. If we have |
| 1949 // an output frame, then we cannot complete the flush at this time. | 1965 // an output frame, then we cannot complete the flush at this time. |
| 1950 if (OutputSamplesPresent()) | 1966 if (OutputSamplesPresent()) |
| 1951 return; | 1967 return; |
| 1952 | 1968 |
| 1953 // First drain the pending input because once the drain message is sent below, | 1969 // First drain the pending input because once the drain message is sent below, |
| 1954 // the decoder will ignore further input until it's drained. | 1970 // the decoder will ignore further input until it's drained. |
| 1955 if (!pending_input_buffers_.empty()) { | 1971 // If we are processing a video configuration change, then we should just |
| 1972 // the drain the decoder. |
| 1973 if (!processing_config_changed_ && !pending_input_buffers_.empty()) { |
| 1956 decoder_thread_task_runner_->PostTask( | 1974 decoder_thread_task_runner_->PostTask( |
| 1957 FROM_HERE, | 1975 FROM_HERE, |
| 1958 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 1976 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 1959 base::Unretained(this))); | 1977 base::Unretained(this))); |
| 1960 decoder_thread_task_runner_->PostTask( | 1978 decoder_thread_task_runner_->PostTask( |
| 1961 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, | 1979 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, |
| 1962 base::Unretained(this))); | 1980 base::Unretained(this))); |
| 1963 return; | 1981 return; |
| 1964 } | 1982 } |
| 1965 | 1983 |
| 1966 { | 1984 { |
| 1967 base::AutoLock lock(decoder_lock_); | 1985 base::AutoLock lock(decoder_lock_); |
| 1968 if (!sent_drain_message_) { | 1986 if (!sent_drain_message_) { |
| 1969 RETURN_AND_NOTIFY_ON_FAILURE(SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0), | 1987 RETURN_AND_NOTIFY_ON_FAILURE(SendMFTMessage(MFT_MESSAGE_COMMAND_DRAIN, 0), |
| 1970 "Failed to send drain message", | 1988 "Failed to send drain message", |
| 1971 PLATFORM_FAILURE, ); | 1989 PLATFORM_FAILURE, ); |
| 1972 sent_drain_message_ = true; | 1990 sent_drain_message_ = true; |
| 1973 } | 1991 } |
| 1974 } | 1992 } |
| 1975 | 1993 |
| 1976 // Attempt to retrieve an output frame from the decoder. If we have one, | 1994 // Attempt to retrieve an output frame from the decoder. If we have one, |
| 1977 // return and proceed when the output frame is processed. If we don't have a | 1995 // return and proceed when the output frame is processed. If we don't have a |
| 1978 // frame then we are done. | 1996 // frame then we are done. |
| 1979 DoDecode(); | 1997 DoDecode(); |
| 1980 if (OutputSamplesPresent()) | 1998 if (OutputSamplesPresent()) |
| 1981 return; | 1999 return; |
| 1982 | 2000 |
| 1983 SetState(kFlushing); | 2001 if (!processing_config_changed_) { |
| 2002 SetState(kFlushing); |
| 1984 | 2003 |
| 1985 main_thread_task_runner_->PostTask( | 2004 main_thread_task_runner_->PostTask( |
| 1986 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::NotifyFlushDone, | 2005 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::NotifyFlushDone, |
| 1987 weak_this_factory_.GetWeakPtr())); | 2006 weak_this_factory_.GetWeakPtr())); |
| 2007 } else { |
| 2008 processing_config_changed_ = false; |
| 2009 main_thread_task_runner_->PostTask( |
| 2010 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::ConfigChanged, |
| 2011 weak_this_factory_.GetWeakPtr(), config_)); |
| 2012 } |
| 1988 | 2013 |
| 1989 SetState(kNormal); | 2014 SetState(kNormal); |
| 1990 } | 2015 } |
| 1991 | 2016 |
| 1992 void DXVAVideoDecodeAccelerator::DecodeInternal( | 2017 void DXVAVideoDecodeAccelerator::DecodeInternal( |
| 1993 const base::win::ScopedComPtr<IMFSample>& sample) { | 2018 const base::win::ScopedComPtr<IMFSample>& sample) { |
| 1994 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::DecodeInternal"); | 2019 TRACE_EVENT0("media", "DXVAVideoDecodeAccelerator::DecodeInternal"); |
| 1995 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); | 2020 DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); |
| 1996 | 2021 |
| 1997 if (GetState() == kUninitialized) | 2022 if (GetState() == kUninitialized) |
| 1998 return; | 2023 return; |
| 1999 | 2024 |
| 2000 if (OutputSamplesPresent() || !pending_input_buffers_.empty()) { | 2025 if (OutputSamplesPresent() || !pending_input_buffers_.empty()) { |
| 2001 pending_input_buffers_.push_back(sample); | 2026 pending_input_buffers_.push_back(sample); |
| 2002 return; | 2027 return; |
| 2003 } | 2028 } |
| 2004 | 2029 |
| 2005 // Check if the resolution, bit rate, etc changed in the stream. If yes we | 2030 // Check if the resolution, bit rate, etc changed in the stream. If yes we |
| 2006 // reinitialize the decoder to ensure that the stream decodes correctly. | 2031 // reinitialize the decoder to ensure that the stream decodes correctly. |
| 2007 bool config_changed = false; | 2032 bool config_changed = false; |
| 2008 | 2033 |
| 2009 HRESULT hr = CheckConfigChanged(sample.get(), &config_changed); | 2034 HRESULT hr = CheckConfigChanged(sample.get(), &config_changed); |
| 2010 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to check video stream config", | 2035 RETURN_AND_NOTIFY_ON_HR_FAILURE(hr, "Failed to check video stream config", |
| 2011 PLATFORM_FAILURE, ); | 2036 PLATFORM_FAILURE, ); |
| 2012 | 2037 |
| 2038 processing_config_changed_ = config_changed; |
| 2039 |
| 2013 if (config_changed) { | 2040 if (config_changed) { |
| 2014 pending_input_buffers_.push_back(sample); | 2041 pending_input_buffers_.push_back(sample); |
| 2015 main_thread_task_runner_->PostTask( | 2042 FlushInternal(); |
| 2016 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::ConfigChanged, | |
| 2017 weak_this_factory_.GetWeakPtr(), config_)); | |
| 2018 return; | 2043 return; |
| 2019 } | 2044 } |
| 2020 | 2045 |
| 2021 if (!inputs_before_decode_) { | 2046 if (!inputs_before_decode_) { |
| 2022 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding", | 2047 TRACE_EVENT_ASYNC_BEGIN0("gpu", "DXVAVideoDecodeAccelerator.Decoding", |
| 2023 this); | 2048 this); |
| 2024 } | 2049 } |
| 2025 inputs_before_decode_++; | 2050 inputs_before_decode_++; |
| 2026 | 2051 |
| 2027 hr = decoder_->ProcessInput(0, sample.get(), 0); | 2052 hr = decoder_->ProcessInput(0, sample.get(), 0); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2249 PLATFORM_FAILURE, ); | 2274 PLATFORM_FAILURE, ); |
| 2250 | 2275 |
| 2251 NotifyPictureReady(picture_buffer->id(), input_buffer_id); | 2276 NotifyPictureReady(picture_buffer->id(), input_buffer_id); |
| 2252 | 2277 |
| 2253 { | 2278 { |
| 2254 base::AutoLock lock(decoder_lock_); | 2279 base::AutoLock lock(decoder_lock_); |
| 2255 if (!pending_output_samples_.empty()) | 2280 if (!pending_output_samples_.empty()) |
| 2256 pending_output_samples_.pop_front(); | 2281 pending_output_samples_.pop_front(); |
| 2257 } | 2282 } |
| 2258 | 2283 |
| 2259 if (pending_flush_) { | 2284 if (pending_flush_ || processing_config_changed_) { |
| 2260 decoder_thread_task_runner_->PostTask( | 2285 decoder_thread_task_runner_->PostTask( |
| 2261 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, | 2286 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, |
| 2262 base::Unretained(this))); | 2287 base::Unretained(this))); |
| 2263 return; | 2288 return; |
| 2264 } | 2289 } |
| 2265 decoder_thread_task_runner_->PostTask( | 2290 decoder_thread_task_runner_->PostTask( |
| 2266 FROM_HERE, | 2291 FROM_HERE, |
| 2267 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2292 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2268 base::Unretained(this))); | 2293 base::Unretained(this))); |
| 2269 } | 2294 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 PLATFORM_FAILURE, ); | 2326 PLATFORM_FAILURE, ); |
| 2302 | 2327 |
| 2303 NotifyPictureReady(picture_buffer->id(), input_buffer_id); | 2328 NotifyPictureReady(picture_buffer->id(), input_buffer_id); |
| 2304 | 2329 |
| 2305 { | 2330 { |
| 2306 base::AutoLock lock(decoder_lock_); | 2331 base::AutoLock lock(decoder_lock_); |
| 2307 if (!pending_output_samples_.empty()) | 2332 if (!pending_output_samples_.empty()) |
| 2308 pending_output_samples_.pop_front(); | 2333 pending_output_samples_.pop_front(); |
| 2309 } | 2334 } |
| 2310 | 2335 |
| 2311 if (pending_flush_) { | 2336 if (pending_flush_ || processing_config_changed_) { |
| 2312 decoder_thread_task_runner_->PostTask( | 2337 decoder_thread_task_runner_->PostTask( |
| 2313 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, | 2338 FROM_HERE, base::Bind(&DXVAVideoDecodeAccelerator::FlushInternal, |
| 2314 base::Unretained(this))); | 2339 base::Unretained(this))); |
| 2315 return; | 2340 return; |
| 2316 } | 2341 } |
| 2317 decoder_thread_task_runner_->PostTask( | 2342 decoder_thread_task_runner_->PostTask( |
| 2318 FROM_HERE, | 2343 FROM_HERE, |
| 2319 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2344 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2320 base::Unretained(this))); | 2345 base::Unretained(this))); |
| 2321 } | 2346 } |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2658 SetState(kConfigChange); | 2683 SetState(kConfigChange); |
| 2659 Invalidate(); | 2684 Invalidate(); |
| 2660 Initialize(config_, client_); | 2685 Initialize(config_, client_); |
| 2661 decoder_thread_task_runner_->PostTask( | 2686 decoder_thread_task_runner_->PostTask( |
| 2662 FROM_HERE, | 2687 FROM_HERE, |
| 2663 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, | 2688 base::Bind(&DXVAVideoDecodeAccelerator::DecodePendingInputBuffers, |
| 2664 base::Unretained(this))); | 2689 base::Unretained(this))); |
| 2665 } | 2690 } |
| 2666 | 2691 |
| 2667 } // namespace media | 2692 } // namespace media |
| OLD | NEW |