| OLD | NEW |
| 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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "remoting/proto/audio.pb.h" | 10 #include "remoting/proto/audio.pb.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 scoped_ptr<AudioPacket> packet(new AudioPacket()); | 72 scoped_ptr<AudioPacket> packet(new AudioPacket()); |
| 73 packet->add_data(data->data()); | 73 packet->add_data(data->data()); |
| 74 packet->set_encoding(AudioPacket::ENCODING_RAW); | 74 packet->set_encoding(AudioPacket::ENCODING_RAW); |
| 75 packet->set_sampling_rate(kSamplingRate); | 75 packet->set_sampling_rate(kSamplingRate); |
| 76 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); | 76 packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); |
| 77 packet->set_channels(AudioPacket::CHANNELS_STEREO); | 77 packet->set_channels(AudioPacket::CHANNELS_STEREO); |
| 78 callback_.Run(packet.Pass()); | 78 callback_.Run(packet.Pass()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool AudioCapturer::IsSupported() { | 81 bool AudioCapturer::IsSupported() { |
| 82 return g_pulseaudio_pipe_sink_reader.Get() != NULL; | 82 return g_pulseaudio_pipe_sink_reader.Get().get() != NULL; |
| 83 } | 83 } |
| 84 | 84 |
| 85 scoped_ptr<AudioCapturer> AudioCapturer::Create() { | 85 scoped_ptr<AudioCapturer> AudioCapturer::Create() { |
| 86 scoped_refptr<AudioPipeReader> reader = | 86 scoped_refptr<AudioPipeReader> reader = |
| 87 g_pulseaudio_pipe_sink_reader.Get(); | 87 g_pulseaudio_pipe_sink_reader.Get(); |
| 88 if (!reader) | 88 if (!reader.get()) |
| 89 return scoped_ptr<AudioCapturer>(); | 89 return scoped_ptr<AudioCapturer>(); |
| 90 return scoped_ptr<AudioCapturer>(new AudioCapturerLinux(reader)); | 90 return scoped_ptr<AudioCapturer>(new AudioCapturerLinux(reader)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 } // namespace remoting | 93 } // namespace remoting |
| OLD | NEW |