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

Side by Side Diff: remoting/protocol/rtcp_writer.cc

Issue 7633009: Use MessageLoopProxy for network message loop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/rtcp_writer.h" 5 #include "remoting/protocol/rtcp_writer.h"
6 6
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "remoting/base/compound_buffer.h" 9 #include "remoting/base/compound_buffer.h"
10 #include "remoting/protocol/buffered_socket_writer.h" 10 #include "remoting/protocol/buffered_socket_writer.h"
11 #include "remoting/protocol/rtp_utils.h" 11 #include "remoting/protocol/rtp_utils.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 namespace protocol { 14 namespace protocol {
15 15
16 RtcpWriter::RtcpWriter() { 16 RtcpWriter::RtcpWriter(base::MessageLoopProxy* message_loop)
17 : buffered_rtcp_writer_(new BufferedDatagramWriter(message_loop)) {
17 } 18 }
18 19
19 RtcpWriter::~RtcpWriter() { 20 RtcpWriter::~RtcpWriter() {
20 } 21 }
21 22
22 void RtcpWriter::Close() { 23 void RtcpWriter::Close() {
23 buffered_rtcp_writer_->Close(); 24 buffered_rtcp_writer_->Close();
24 } 25 }
25 26
26 // Initializes the writer. Must be called on the thread the sockets 27 // Initializes the writer. Must be called on the thread the sockets
27 // belong to. 28 // belong to.
28 void RtcpWriter::Init(net::Socket* socket) { 29 void RtcpWriter::Init(net::Socket* socket) {
29 buffered_rtcp_writer_ = new BufferedDatagramWriter();
30 buffered_rtcp_writer_->Init(socket, NULL); 30 buffered_rtcp_writer_->Init(socket, NULL);
31 } 31 }
32 32
33 void RtcpWriter::SendReport(const RtcpReceiverReport& report) { 33 void RtcpWriter::SendReport(const RtcpReceiverReport& report) {
34 int size = GetRtcpReceiverReportSize(report); 34 int size = GetRtcpReceiverReportSize(report);
35 net::IOBufferWithSize* buffer = new net::IOBufferWithSize(size); 35 net::IOBufferWithSize* buffer = new net::IOBufferWithSize(size);
36 36
37 PackRtcpReceiverReport(report, reinterpret_cast<uint8*>(buffer->data()), 37 PackRtcpReceiverReport(report, reinterpret_cast<uint8*>(buffer->data()),
38 size); 38 size);
39 39
40 buffered_rtcp_writer_->Write(buffer, NULL); 40 buffered_rtcp_writer_->Write(buffer, NULL);
41 } 41 }
42 42
43 } // namespace protocol 43 } // namespace protocol
44 } // namespace remoting 44 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698