Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / remoting / protocol / audio_writer.cc
blobbe60d2e6955f9a02ee10a7b86627093babbfea3f
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
3 // found in the LICENSE file.
5 #include "remoting/protocol/audio_writer.h"
7 #include "base/bind.h"
8 #include "net/socket/stream_socket.h"
9 #include "remoting/base/constants.h"
10 #include "remoting/proto/audio.pb.h"
11 #include "remoting/protocol/message_serialization.h"
12 #include "remoting/protocol/session.h"
13 #include "remoting/protocol/session_config.h"
15 namespace remoting {
16 namespace protocol {
18 AudioWriter::AudioWriter()
19 : ChannelDispatcherBase(kAudioChannelName) {
22 AudioWriter::~AudioWriter() {
25 void AudioWriter::ProcessAudioPacket(scoped_ptr<AudioPacket> packet,
26 const base::Closure& done) {
27 writer()->Write(SerializeAndFrameMessage(*packet), done);
30 // static
31 scoped_ptr<AudioWriter> AudioWriter::Create(const SessionConfig& config) {
32 if (!config.is_audio_enabled())
33 return nullptr;
34 return make_scoped_ptr(new AudioWriter());
37 } // namespace protocol
38 } // namespace remoting