OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/mojo/common/mojo_decoder_buffer_converter.h" | 5 #include "media/mojo/common/mojo_decoder_buffer_converter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const char kIv[] = "0123456789abcdef"; | 104 const char kIv[] = "0123456789abcdef"; |
105 | 105 |
106 std::vector<SubsampleEntry> subsamples; | 106 std::vector<SubsampleEntry> subsamples; |
107 subsamples.push_back(SubsampleEntry(10, 20)); | 107 subsamples.push_back(SubsampleEntry(10, 20)); |
108 subsamples.push_back(SubsampleEntry(30, 40)); | 108 subsamples.push_back(SubsampleEntry(30, 40)); |
109 subsamples.push_back(SubsampleEntry(50, 60)); | 109 subsamples.push_back(SubsampleEntry(50, 60)); |
110 | 110 |
111 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom( | 111 scoped_refptr<DecoderBuffer> buffer(DecoderBuffer::CopyFrom( |
112 reinterpret_cast<const uint8_t*>(&kData), kDataSize)); | 112 reinterpret_cast<const uint8_t*>(&kData), kDataSize)); |
113 buffer->set_decrypt_config( | 113 buffer->set_decrypt_config( |
114 base::WrapUnique(new DecryptConfig(kKeyId, kIv, subsamples))); | 114 base::MakeUnique<DecryptConfig>(kKeyId, kIv, subsamples)); |
115 | 115 |
116 scoped_refptr<DecoderBuffer> result = ConvertDecoderBufferAndBack(buffer); | 116 scoped_refptr<DecoderBuffer> result = ConvertDecoderBufferAndBack(buffer); |
117 CompareDecoderBuffer(buffer, result); | 117 CompareDecoderBuffer(buffer, result); |
118 | 118 |
119 // Test empty IV. This is used for clear buffer in an encrypted stream. | 119 // Test empty IV. This is used for clear buffer in an encrypted stream. |
120 buffer->set_decrypt_config(base::WrapUnique( | 120 buffer->set_decrypt_config(base::MakeUnique<DecryptConfig>( |
121 new DecryptConfig(kKeyId, "", std::vector<SubsampleEntry>()))); | 121 kKeyId, "", std::vector<SubsampleEntry>())); |
122 result = ConvertDecoderBufferAndBack(buffer); | 122 result = ConvertDecoderBufferAndBack(buffer); |
123 CompareDecoderBuffer(buffer, result); | 123 CompareDecoderBuffer(buffer, result); |
124 } | 124 } |
125 | 125 |
126 } // namespace media | 126 } // namespace media |
OLD | NEW |