| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/gpu/rtc_video_decoder.h" | 5 #include "content/renderer/media/gpu/rtc_video_decoder.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "base/win/windows_version.h" | 29 #include "base/win/windows_version.h" |
| 30 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 31 #endif // defined(OS_WIN) | 31 #endif // defined(OS_WIN) |
| 32 | 32 |
| 33 namespace content { | 33 namespace content { |
| 34 | 34 |
| 35 const int32_t RTCVideoDecoder::ID_LAST = 0x3FFFFFFF; | 35 const int32_t RTCVideoDecoder::ID_LAST = 0x3FFFFFFF; |
| 36 const int32_t RTCVideoDecoder::ID_HALF = 0x20000000; | 36 const int32_t RTCVideoDecoder::ID_HALF = 0x20000000; |
| 37 const int32_t RTCVideoDecoder::ID_INVALID = -1; | 37 const int32_t RTCVideoDecoder::ID_INVALID = -1; |
| 38 | 38 |
| 39 // Android vp8, vp9 decoders are quite finicky and often out of date, so give | 39 // Number of consecutive frames that can be lost due to a VDA error before |
| 40 // them much less leeway on errors than other platforms. | 40 // falling back to SW implementation. |
| 41 #if defined(OS_ANDROID) | |
| 42 const uint32_t kNumVDAErrorsBeforeSWFallback = 5; | 41 const uint32_t kNumVDAErrorsBeforeSWFallback = 5; |
| 43 #else | |
| 44 const uint32_t kNumVDAErrorsBeforeSWFallback = 50; | |
| 45 #endif | |
| 46 | 42 |
| 47 // Maximum number of concurrent VDA::Decode() operations RVD will maintain. | 43 // Maximum number of concurrent VDA::Decode() operations RVD will maintain. |
| 48 // Higher values allow better pipelining in the GPU, but also require more | 44 // Higher values allow better pipelining in the GPU, but also require more |
| 49 // resources. | 45 // resources. |
| 50 static const size_t kMaxInFlightDecodes = 8; | 46 static const size_t kMaxInFlightDecodes = 8; |
| 51 | 47 |
| 52 // Number of allocated shared memory segments. | 48 // Number of allocated shared memory segments. |
| 53 static const size_t kNumSharedMemorySegments = 16; | 49 static const size_t kNumSharedMemorySegments = 16; |
| 54 | 50 |
| 55 // Maximum number of pending WebRTC buffers that are waiting for shared memory. | 51 // Maximum number of pending WebRTC buffers that are waiting for shared memory. |
| (...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 } | 889 } |
| 894 | 890 |
| 895 void RTCVideoDecoder::ClearPendingBuffers() { | 891 void RTCVideoDecoder::ClearPendingBuffers() { |
| 896 // Delete WebRTC input buffers. | 892 // Delete WebRTC input buffers. |
| 897 for (const auto& pending_buffer : pending_buffers_) | 893 for (const auto& pending_buffer : pending_buffers_) |
| 898 delete[] pending_buffer.first._buffer; | 894 delete[] pending_buffer.first._buffer; |
| 899 pending_buffers_.clear(); | 895 pending_buffers_.clear(); |
| 900 } | 896 } |
| 901 | 897 |
| 902 } // namespace content | 898 } // namespace content |
| OLD | NEW |