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

Side by Side Diff: webkit/media/audio_decoder.cc

Issue 8786013: Replace media::Limits struct with media::limits namespace and update documentation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix logic Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | webkit/media/webmediaplayer_impl.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/media/audio_decoder.h" 5 #include "webkit/media/audio_decoder.h"
6 6
7 #include <vector> 7 #include <vector>
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 26 matching lines...) Expand all
37 return false; 37 return false;
38 38
39 size_t number_of_channels = reader.channels(); 39 size_t number_of_channels = reader.channels();
40 double file_sample_rate = reader.sample_rate(); 40 double file_sample_rate = reader.sample_rate();
41 double duration = reader.duration().InSecondsF(); 41 double duration = reader.duration().InSecondsF();
42 size_t number_of_frames = static_cast<size_t>(reader.number_of_frames()); 42 size_t number_of_frames = static_cast<size_t>(reader.number_of_frames());
43 43
44 // Apply sanity checks to make sure crazy values aren't coming out of 44 // Apply sanity checks to make sure crazy values aren't coming out of
45 // FFmpeg. 45 // FFmpeg.
46 if (!number_of_channels || 46 if (!number_of_channels ||
47 number_of_channels > static_cast<size_t>(media::Limits::kMaxChannels) || 47 number_of_channels > static_cast<size_t>(media::limits::kMaxChannels) ||
48 file_sample_rate < media::Limits::kMinSampleRate || 48 file_sample_rate < media::limits::kMinSampleRate ||
49 file_sample_rate > media::Limits::kMaxSampleRate) 49 file_sample_rate > media::limits::kMaxSampleRate)
50 return false; 50 return false;
51 51
52 // TODO(crogers) : do sample-rate conversion with FFmpeg. 52 // TODO(crogers) : do sample-rate conversion with FFmpeg.
53 // For now, we're ignoring the requested 'sample_rate' and returning 53 // For now, we're ignoring the requested 'sample_rate' and returning
54 // the WebAudioBus at the file's sample-rate. 54 // the WebAudioBus at the file's sample-rate.
55 // double destination_sample_rate = 55 // double destination_sample_rate =
56 // (sample_rate != 0.0) ? sample_rate : file_sample_rate; 56 // (sample_rate != 0.0) ? sample_rate : file_sample_rate;
57 double destination_sample_rate = file_sample_rate; 57 double destination_sample_rate = file_sample_rate;
58 58
59 DLOG(INFO) << "Decoding file data -" 59 DLOG(INFO) << "Decoding file data -"
(...skipping 18 matching lines...) Expand all
78 audio_data.reserve(number_of_channels); 78 audio_data.reserve(number_of_channels);
79 for (size_t i = 0; i < number_of_channels; ++i) { 79 for (size_t i = 0; i < number_of_channels; ++i) {
80 audio_data.push_back(destination_bus->channelData(i)); 80 audio_data.push_back(destination_bus->channelData(i));
81 } 81 }
82 82
83 // Decode the audio file data. 83 // Decode the audio file data.
84 return reader.Read(audio_data, number_of_frames); 84 return reader.Read(audio_data, number_of_frames);
85 } 85 }
86 86
87 } // namespace webkit_media 87 } // namespace webkit_media
OLDNEW
« no previous file with comments | « media/filters/video_renderer_base.cc ('k') | webkit/media/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698