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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 channel_ptrs[i] = cur + i * size_per_channel; | 1019 channel_ptrs[i] = cur + i * size_per_channel; |
1020 | 1020 |
1021 const int frame_count = frame_size / audio_bytes_per_frame; | 1021 const int frame_count = frame_size / audio_bytes_per_frame; |
1022 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( | 1022 scoped_refptr<media::AudioBuffer> frame = media::AudioBuffer::CopyFrom( |
1023 sample_format, | 1023 sample_format, |
1024 audio_channel_layout_, | 1024 audio_channel_layout_, |
1025 audio_channel_count_, | 1025 audio_channel_count_, |
1026 audio_samples_per_second_, | 1026 audio_samples_per_second_, |
1027 frame_count, | 1027 frame_count, |
1028 &channel_ptrs[0], | 1028 &channel_ptrs[0], |
1029 base::TimeDelta::FromMicroseconds(timestamp)); | 1029 base::TimeDelta::FromMicroseconds(timestamp), |
| 1030 base::TimeDelta::FromMicroseconds(audio_samples_per_second_ / |
| 1031 frame_count)); |
1030 frames->push_back(frame); | 1032 frames->push_back(frame); |
1031 | 1033 |
1032 cur += frame_size; | 1034 cur += frame_size; |
1033 bytes_left -= frame_size; | 1035 bytes_left -= frame_size; |
1034 } while (bytes_left > 0); | 1036 } while (bytes_left > 0); |
1035 | 1037 |
1036 return true; | 1038 return true; |
1037 } | 1039 } |
1038 | 1040 |
1039 void ContentDecryptorDelegate::SatisfyAllPendingCallbacksOnError() { | 1041 void ContentDecryptorDelegate::SatisfyAllPendingCallbacksOnError() { |
(...skipping 16 matching lines...) Expand all Loading... |
1056 const media::Decryptor::AudioBuffers empty_frames; | 1058 const media::Decryptor::AudioBuffers empty_frames; |
1057 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, | 1059 audio_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, |
1058 empty_frames); | 1060 empty_frames); |
1059 } | 1061 } |
1060 | 1062 |
1061 if (!video_decode_cb_.is_null()) | 1063 if (!video_decode_cb_.is_null()) |
1062 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); | 1064 video_decode_cb_.ResetAndReturn().Run(media::Decryptor::kError, NULL); |
1063 } | 1065 } |
1064 | 1066 |
1065 } // namespace content | 1067 } // namespace content |
OLD | NEW |