Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 212103013: Add channel_count parameter back to AudioBuffer creation methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mstr
Patch Set: fix unit test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | media/base/audio_buffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | media/base/audio_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698