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/protocol/audio_writer.h" | 5 #include "remoting/protocol/audio_writer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" |
8 #include "net/socket/stream_socket.h" | 9 #include "net/socket/stream_socket.h" |
9 #include "remoting/base/compound_buffer.h" | 10 #include "remoting/base/compound_buffer.h" |
10 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
11 #include "remoting/proto/audio.pb.h" | 12 #include "remoting/proto/audio.pb.h" |
12 #include "remoting/protocol/message_pipe.h" | 13 #include "remoting/protocol/message_pipe.h" |
13 #include "remoting/protocol/session.h" | 14 #include "remoting/protocol/session.h" |
14 #include "remoting/protocol/session_config.h" | 15 #include "remoting/protocol/session_config.h" |
15 | 16 |
16 namespace remoting { | 17 namespace remoting { |
17 namespace protocol { | 18 namespace protocol { |
18 | 19 |
19 AudioWriter::AudioWriter() : ChannelDispatcherBase(kAudioChannelName) {} | 20 AudioWriter::AudioWriter() : ChannelDispatcherBase(kAudioChannelName) {} |
20 AudioWriter::~AudioWriter() {} | 21 AudioWriter::~AudioWriter() {} |
21 | 22 |
22 void AudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet, | 23 void AudioWriter::ProcessAudioPacket(std::unique_ptr<AudioPacket> packet, |
23 const base::Closure& done) { | 24 const base::Closure& done) { |
24 message_pipe()->Send(packet.get(), done); | 25 message_pipe()->Send(packet.get(), done); |
25 } | 26 } |
26 | 27 |
27 // static | 28 // static |
28 scoped_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) { | 29 std::unique_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) { |
29 if (!config.is_audio_enabled()) | 30 if (!config.is_audio_enabled()) |
30 return nullptr; | 31 return nullptr; |
31 return make_scoped_ptr(new AudioWriter()); | 32 return base::WrapUnique(new AudioWriter()); |
32 } | 33 } |
33 | 34 |
34 void AudioWriter::OnIncomingMessage(scoped_ptr<CompoundBuffer> message) { | 35 void AudioWriter::OnIncomingMessage(std::unique_ptr<CompoundBuffer> message) { |
35 LOG(ERROR) << "Received unexpected message on the audio channel."; | 36 LOG(ERROR) << "Received unexpected message on the audio channel."; |
36 } | 37 } |
37 | 38 |
38 } // namespace protocol | 39 } // namespace protocol |
39 } // namespace remoting | 40 } // namespace remoting |
OLD | NEW |