OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/cdm/cdm_adapter.h" | 5 #include "media/cdm/cdm_adapter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 cdm_config_(cdm_config), | 369 cdm_config_(cdm_config), |
370 session_message_cb_(session_message_cb), | 370 session_message_cb_(session_message_cb), |
371 session_closed_cb_(session_closed_cb), | 371 session_closed_cb_(session_closed_cb), |
372 session_keys_change_cb_(session_keys_change_cb), | 372 session_keys_change_cb_(session_keys_change_cb), |
373 session_expiration_update_cb_(session_expiration_update_cb), | 373 session_expiration_update_cb_(session_expiration_update_cb), |
374 audio_samples_per_second_(0), | 374 audio_samples_per_second_(0), |
375 audio_channel_layout_(CHANNEL_LAYOUT_NONE), | 375 audio_channel_layout_(CHANNEL_LAYOUT_NONE), |
376 allocator_(std::move(allocator)), | 376 allocator_(std::move(allocator)), |
377 create_cdm_file_io_cb_(create_cdm_file_io_cb), | 377 create_cdm_file_io_cb_(create_cdm_file_io_cb), |
378 task_runner_(base::ThreadTaskRunnerHandle::Get()), | 378 task_runner_(base::ThreadTaskRunnerHandle::Get()), |
| 379 pool_(new AudioBufferMemoryPool()), |
379 weak_factory_(this) { | 380 weak_factory_(this) { |
380 DCHECK(!key_system_.empty()); | 381 DCHECK(!key_system_.empty()); |
381 DCHECK(!session_message_cb_.is_null()); | 382 DCHECK(!session_message_cb_.is_null()); |
382 DCHECK(!session_closed_cb_.is_null()); | 383 DCHECK(!session_closed_cb_.is_null()); |
383 DCHECK(!session_keys_change_cb_.is_null()); | 384 DCHECK(!session_keys_change_cb_.is_null()); |
384 DCHECK(!session_expiration_update_cb_.is_null()); | 385 DCHECK(!session_expiration_update_cb_.is_null()); |
385 DCHECK(allocator_); | 386 DCHECK(allocator_); |
386 } | 387 } |
387 | 388 |
388 CdmAdapter::~CdmAdapter() {} | 389 CdmAdapter::~CdmAdapter() {} |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 // Setup channel pointers. AudioBuffer::CopyFrom() will only use the first | 930 // Setup channel pointers. AudioBuffer::CopyFrom() will only use the first |
930 // one in the case of interleaved data. | 931 // one in the case of interleaved data. |
931 const int size_per_channel = frame_size / audio_channel_count; | 932 const int size_per_channel = frame_size / audio_channel_count; |
932 for (int i = 0; i < audio_channel_count; ++i) | 933 for (int i = 0; i < audio_channel_count; ++i) |
933 channel_ptrs[i] = data + i * size_per_channel; | 934 channel_ptrs[i] = data + i * size_per_channel; |
934 | 935 |
935 const int frame_count = frame_size / audio_bytes_per_frame; | 936 const int frame_count = frame_size / audio_bytes_per_frame; |
936 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( | 937 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( |
937 sample_format, audio_channel_layout_, audio_channel_count, | 938 sample_format, audio_channel_layout_, audio_channel_count, |
938 audio_samples_per_second_, frame_count, &channel_ptrs[0], | 939 audio_samples_per_second_, frame_count, &channel_ptrs[0], |
939 base::TimeDelta::FromMicroseconds(timestamp)); | 940 base::TimeDelta::FromMicroseconds(timestamp), pool_); |
940 result_frames->push_back(frame); | 941 result_frames->push_back(frame); |
941 | 942 |
942 data += frame_size; | 943 data += frame_size; |
943 bytes_left -= frame_size; | 944 bytes_left -= frame_size; |
944 } while (bytes_left > 0); | 945 } while (bytes_left > 0); |
945 | 946 |
946 return true; | 947 return true; |
947 } | 948 } |
948 | 949 |
949 } // namespace media | 950 } // namespace media |
OLD | NEW |