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

Side by Side Diff: remoting/codec/audio_decoder_opus.cc

Issue 1236663002: Allow shaped-desktop hosts to send shape only when it changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Pepper 2D renderer build Created 5 years, 5 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 | « remoting/client/software_video_renderer.cc ('k') | remoting/codec/codec_test.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 "remoting/codec/audio_decoder_opus.h" 5 #include "remoting/codec/audio_decoder_opus.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "remoting/proto/audio.pb.h" 10 #include "remoting/proto/audio.pb.h"
11 #include "third_party/opus/src/include/opus.h" 11 #include "third_party/opus/src/include/opus.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 namespace { 15 namespace {
16 16
17 // Maximum size of an Opus frame in milliseconds. 17 // Maximum size of an Opus frame in milliseconds.
18 const int kMaxFrameSizeMs = 120; 18 const int kMaxFrameSizeMs = 120;
19 19
20 // Hosts will never generate more than 100 frames in a single packet. 20 // Hosts will never generate more than 100 frames in a single packet.
21 const int kMaxFramesPerPacket = 100; 21 const int kMaxFramesPerPacket = 100;
22 22
23 const AudioPacket::SamplingRate kSamplingRate = 23 const AudioPacket::SamplingRate kSamplingRate =
24 AudioPacket::SAMPLING_RATE_48000; 24 AudioPacket::SAMPLING_RATE_48000;
25 25
26 } // namespace 26 } // namespace
27 27
28 AudioDecoderOpus::AudioDecoderOpus() 28 AudioDecoderOpus::AudioDecoderOpus()
29 : sampling_rate_(0), 29 : sampling_rate_(0), channels_(0), decoder_(nullptr) {}
30 channels_(0),
31 decoder_(nullptr) {
32 }
33 30
34 AudioDecoderOpus::~AudioDecoderOpus() { 31 AudioDecoderOpus::~AudioDecoderOpus() {
35 DestroyDecoder(); 32 DestroyDecoder();
36 } 33 }
37 34
38 void AudioDecoderOpus::InitDecoder() { 35 void AudioDecoderOpus::InitDecoder() {
39 DCHECK(!decoder_); 36 DCHECK(!decoder_);
40 int error; 37 int error;
41 decoder_ = opus_decoder_create(kSamplingRate, channels_, &error); 38 decoder_ = opus_decoder_create(kSamplingRate, channels_, &error);
42 if (!decoder_) { 39 if (!decoder_) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!buffer_pos) { 128 if (!buffer_pos) {
132 return nullptr; 129 return nullptr;
133 } 130 }
134 131
135 decoded_data->resize(buffer_pos); 132 decoded_data->resize(buffer_pos);
136 133
137 return decoded_packet.Pass(); 134 return decoded_packet.Pass();
138 } 135 }
139 136
140 } // namespace remoting 137 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/software_video_renderer.cc ('k') | remoting/codec/codec_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698