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

Side by Side Diff: media/filters/opus_audio_decoder.cc

Issue 63153003: mac: Prepare for -Wunused-functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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/audio/mac/audio_auhal_mac.cc ('k') | net/cert/ct_serialization.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) 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 "media/filters/opus_audio_decoder.h" 5 #include "media/filters/opus_audio_decoder.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 14 matching lines...) Expand all
25 namespace media { 25 namespace media {
26 26
27 static uint16 ReadLE16(const uint8* data, size_t data_size, int read_offset) { 27 static uint16 ReadLE16(const uint8* data, size_t data_size, int read_offset) {
28 DCHECK(data); 28 DCHECK(data);
29 uint16 value = 0; 29 uint16 value = 0;
30 DCHECK_LE(read_offset + sizeof(value), data_size); 30 DCHECK_LE(read_offset + sizeof(value), data_size);
31 memcpy(&value, data + read_offset, sizeof(value)); 31 memcpy(&value, data + read_offset, sizeof(value));
32 return base::ByteSwapToLE16(value); 32 return base::ByteSwapToLE16(value);
33 } 33 }
34 34
35 // Returns true if the decode result was end of stream.
36 static inline bool IsEndOfStream(int decoded_size,
37 const scoped_refptr<DecoderBuffer>& input) {
38 // Two conditions to meet to declare end of stream for this decoder:
39 // 1. Opus didn't output anything.
40 // 2. An end of stream buffer is received.
41 return decoded_size == 0 && input->end_of_stream();
42 }
43
44 static int TimeDeltaToAudioFrames(base::TimeDelta time_delta, 35 static int TimeDeltaToAudioFrames(base::TimeDelta time_delta,
45 int frame_rate) { 36 int frame_rate) {
46 return std::ceil(time_delta.InSecondsF() * frame_rate); 37 return std::ceil(time_delta.InSecondsF() * frame_rate);
47 } 38 }
48 39
49 // The Opus specification is part of IETF RFC 6716: 40 // The Opus specification is part of IETF RFC 6716:
50 // http://tools.ietf.org/html/rfc6716 41 // http://tools.ietf.org/html/rfc6716
51 42
52 // Opus uses Vorbis channel mapping, and Vorbis channel mapping specifies 43 // Opus uses Vorbis channel mapping, and Vorbis channel mapping specifies
53 // mappings for up to 8 channels. This information is part of the Vorbis I 44 // mappings for up to 8 channels. This information is part of the Vorbis I
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 PipelineStatistics statistics; 603 PipelineStatistics statistics;
613 statistics.audio_bytes_decoded = 604 statistics.audio_bytes_decoded =
614 frames_decoded * 605 frames_decoded *
615 demuxer_stream_->audio_decoder_config().bytes_per_frame(); 606 demuxer_stream_->audio_decoder_config().bytes_per_frame();
616 statistics_cb_.Run(statistics); 607 statistics_cb_.Run(statistics);
617 608
618 return true; 609 return true;
619 } 610 }
620 611
621 } // namespace media 612 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/mac/audio_auhal_mac.cc ('k') | net/cert/ct_serialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698