| 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 "content/renderer/pepper/content_decryptor_delegate.h" | 5 #include "content/renderer/pepper/content_decryptor_delegate.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1017 // Setup channel pointers. AudioBuffer::CopyFrom() will only use the first | 1017 // Setup channel pointers. AudioBuffer::CopyFrom() will only use the first |
| 1018 // one in the case of interleaved data. | 1018 // one in the case of interleaved data. |
| 1019 const int size_per_channel = frame_size / audio_channel_count_; | 1019 const int size_per_channel = frame_size / audio_channel_count_; |
| 1020 for (int i = 0; i < audio_channel_count_; ++i) | 1020 for (int i = 0; i < audio_channel_count_; ++i) |
| 1021 channel_ptrs[i] = cur + i * size_per_channel; | 1021 channel_ptrs[i] = cur + i * size_per_channel; |
| 1022 | 1022 |
| 1023 const int frame_count = frame_size / audio_bytes_per_frame; | 1023 const int frame_count = frame_size / audio_bytes_per_frame; |
| 1024 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( | 1024 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( |
| 1025 sample_format, | 1025 sample_format, |
| 1026 audio_channel_layout_, | 1026 audio_channel_layout_, |
| 1027 audio_channel_count_, |
| 1027 audio_samples_per_second_, | 1028 audio_samples_per_second_, |
| 1028 frame_count, | 1029 frame_count, |
| 1029 &channel_ptrs[0], | 1030 &channel_ptrs[0], |
| 1030 base::TimeDelta::FromMicroseconds(timestamp), | 1031 base::TimeDelta::FromMicroseconds(timestamp), |
| 1031 base::TimeDelta::FromMicroseconds(audio_samples_per_second_ / | 1032 base::TimeDelta::FromMicroseconds(audio_samples_per_second_ / |
| 1032 frame_count)); | 1033 frame_count)); |
| 1033 frames->push_back(frame); | 1034 frames->push_back(frame); |
| 1034 | 1035 |
| 1035 cur += frame_size; | 1036 cur += frame_size; |
| 1036 bytes_left -= frame_size; | 1037 bytes_left -= frame_size; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1059 const media::Decryptor::AudioBuffers empty_frames; | 1060 const media::Decryptor::AudioBuffers empty_frames; |
| 1060 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, | 1061 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, |
| 1061 empty_frames); | 1062 empty_frames); |
| 1062 } | 1063 } |
| 1063 | 1064 |
| 1064 if (!video_decode_cb_.is_null()) | 1065 if (!video_decode_cb_.is_null()) |
| 1065 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1066 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
| 1066 } | 1067 } |
| 1067 | 1068 |
| 1068 } // namespace content | 1069 } // namespace content |
| OLD | NEW |