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/filters/decrypting_demuxer_stream.h" | 5 #include "media/filters/decrypting_demuxer_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 DVLOG(2) << "DoDecryptBuffer() - EOS buffer."; | 204 DVLOG(2) << "DoDecryptBuffer() - EOS buffer."; |
205 state_ = kIdle; | 205 state_ = kIdle; |
206 base::ResetAndReturn(&read_cb_).Run(status, buffer); | 206 base::ResetAndReturn(&read_cb_).Run(status, buffer); |
207 return; | 207 return; |
208 } | 208 } |
209 | 209 |
210 DCHECK(buffer->decrypt_config()); | 210 DCHECK(buffer->decrypt_config()); |
211 // An empty iv string signals that the frame is unencrypted. | 211 // An empty iv string signals that the frame is unencrypted. |
212 if (buffer->decrypt_config()->iv().empty()) { | 212 if (buffer->decrypt_config()->iv().empty()) { |
213 DVLOG(2) << "DoDecryptBuffer() - clear buffer."; | 213 DVLOG(2) << "DoDecryptBuffer() - clear buffer."; |
214 int data_offset = buffer->decrypt_config()->data_offset(); | |
215 scoped_refptr<DecoderBuffer> decrypted = DecoderBuffer::CopyFrom( | 214 scoped_refptr<DecoderBuffer> decrypted = DecoderBuffer::CopyFrom( |
216 buffer->data() + data_offset, buffer->data_size() - data_offset); | 215 buffer->data(), buffer->data_size()); |
217 decrypted->set_timestamp(buffer->timestamp()); | 216 decrypted->set_timestamp(buffer->timestamp()); |
218 decrypted->set_duration(buffer->duration()); | 217 decrypted->set_duration(buffer->duration()); |
219 state_ = kIdle; | 218 state_ = kIdle; |
220 base::ResetAndReturn(&read_cb_).Run(kOk, decrypted); | 219 base::ResetAndReturn(&read_cb_).Run(kOk, decrypted); |
221 return; | 220 return; |
222 } | 221 } |
223 | 222 |
224 pending_buffer_to_decrypt_ = buffer; | 223 pending_buffer_to_decrypt_ = buffer; |
225 state_ = kPendingDecrypt; | 224 state_ = kPendingDecrypt; |
226 DecryptPendingBuffer(); | 225 DecryptPendingBuffer(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 break; | 355 break; |
357 } | 356 } |
358 | 357 |
359 default: | 358 default: |
360 NOTREACHED(); | 359 NOTREACHED(); |
361 return; | 360 return; |
362 } | 361 } |
363 } | 362 } |
364 | 363 |
365 } // namespace media | 364 } // namespace media |
OLD | NEW |