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

Side by Side Diff: remoting/host/audio_capturer_linux.cc

Issue 1547473005: Switch to standard integer types in remoting/host/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/host/audio_capturer_linux.h ('k') | remoting/host/audio_capturer_win.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 "remoting/host/audio_capturer_linux.h" 5 #include "remoting/host/audio_capturer_linux.h"
6 6
7 #include <stdint.h>
8
7 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
8 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "remoting/proto/audio.pb.h" 12 #include "remoting/proto/audio.pb.h"
11 13
12 namespace remoting { 14 namespace remoting {
13 15
14 namespace { 16 namespace {
15 17
16 base::LazyInstance<scoped_refptr<AudioPipeReader> >::Leaky 18 base::LazyInstance<scoped_refptr<AudioPipeReader> >::Leaky
(...skipping 29 matching lines...) Expand all
46 AudioPipeReader::kChannels); 48 AudioPipeReader::kChannels);
47 pipe_reader_->AddObserver(this); 49 pipe_reader_->AddObserver(this);
48 return true; 50 return true;
49 } 51 }
50 52
51 void AudioCapturerLinux::OnDataRead( 53 void AudioCapturerLinux::OnDataRead(
52 scoped_refptr<base::RefCountedString> data) { 54 scoped_refptr<base::RefCountedString> data) {
53 DCHECK(!callback_.is_null()); 55 DCHECK(!callback_.is_null());
54 56
55 if (silence_detector_.IsSilence( 57 if (silence_detector_.IsSilence(
56 reinterpret_cast<const int16*>(data->data().data()), 58 reinterpret_cast<const int16_t*>(data->data().data()),
57 data->data().size() / sizeof(int16))) { 59 data->data().size() / sizeof(int16_t))) {
58 return; 60 return;
59 } 61 }
60 62
61 scoped_ptr<AudioPacket> packet(new AudioPacket()); 63 scoped_ptr<AudioPacket> packet(new AudioPacket());
62 packet->add_data(data->data()); 64 packet->add_data(data->data());
63 packet->set_encoding(AudioPacket::ENCODING_RAW); 65 packet->set_encoding(AudioPacket::ENCODING_RAW);
64 packet->set_sampling_rate(AudioPipeReader::kSamplingRate); 66 packet->set_sampling_rate(AudioPipeReader::kSamplingRate);
65 packet->set_bytes_per_sample(AudioPipeReader::kBytesPerSample); 67 packet->set_bytes_per_sample(AudioPipeReader::kBytesPerSample);
66 packet->set_channels(AudioPipeReader::kChannels); 68 packet->set_channels(AudioPipeReader::kChannels);
67 callback_.Run(packet.Pass()); 69 callback_.Run(packet.Pass());
68 } 70 }
69 71
70 bool AudioCapturer::IsSupported() { 72 bool AudioCapturer::IsSupported() {
71 return g_pulseaudio_pipe_sink_reader.Get().get() != nullptr; 73 return g_pulseaudio_pipe_sink_reader.Get().get() != nullptr;
72 } 74 }
73 75
74 scoped_ptr<AudioCapturer> AudioCapturer::Create() { 76 scoped_ptr<AudioCapturer> AudioCapturer::Create() {
75 scoped_refptr<AudioPipeReader> reader = 77 scoped_refptr<AudioPipeReader> reader =
76 g_pulseaudio_pipe_sink_reader.Get(); 78 g_pulseaudio_pipe_sink_reader.Get();
77 if (!reader.get()) 79 if (!reader.get())
78 return nullptr; 80 return nullptr;
79 return make_scoped_ptr(new AudioCapturerLinux(reader)); 81 return make_scoped_ptr(new AudioCapturerLinux(reader));
80 } 82 }
81 83
82 } // namespace remoting 84 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/audio_capturer_linux.h ('k') | remoting/host/audio_capturer_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698