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