Index: media/cdm/simple_cdm_buffer.cc |
diff --git a/media/cdm/simple_cdm_buffer.cc b/media/cdm/simple_cdm_buffer.cc |
index c5f3b8bbf96d0e88d159cb81d49e299a1ad148f8..538b0c4c1732050aebb90d1e5db236ca9906348f 100644 |
--- a/media/cdm/simple_cdm_buffer.cc |
+++ b/media/cdm/simple_cdm_buffer.cc |
@@ -4,14 +4,21 @@ |
#include "media/cdm/simple_cdm_buffer.h" |
+#include <limits> |
+ |
#include "base/logging.h" |
+#include "base/numerics/safe_conversions.h" |
namespace media { |
// static |
-SimpleCdmBuffer* SimpleCdmBuffer::Create(uint32_t capacity) { |
+SimpleCdmBuffer* SimpleCdmBuffer::Create(size_t capacity) { |
DCHECK(capacity); |
- return new SimpleCdmBuffer(capacity); |
+ |
+ // cdm::Buffer interface limits capacity to uint32. |
+ DCHECK_LE(capacity, |
+ static_cast<size_t>(std::numeric_limits<uint32_t>::max())); |
xhwang
2016/03/15 18:57:37
OOC, can you drop the static_cast since both size_
jrummell
2016/03/15 19:43:12
Done.
|
+ return new SimpleCdmBuffer(base::checked_cast<uint32_t>(capacity)); |
} |
SimpleCdmBuffer::SimpleCdmBuffer(uint32_t capacity) |