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

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

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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/rtp_writer.h" 5 #include "remoting/protocol/rtp_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/rtp_utils.h" 10 #include "remoting/protocol/rtp_utils.h"
11 11
12 namespace remoting { 12 namespace remoting {
13 namespace protocol { 13 namespace protocol {
14 14
15 namespace { 15 namespace {
16 const uint8 kRtpPayloadTypePrivate = 96; 16 const uint8 kRtpPayloadTypePrivate = 96;
17 } // namespace 17 } // namespace
18 18
19 RtpWriter::RtpWriter(base::MessageLoopProxy* message_loop) 19 RtpWriter::RtpWriter(base::MessageLoopProxy* message_loop)
20 : last_packet_number_(0), 20 : last_packet_number_(0),
21 buffered_rtp_writer_(new BufferedDatagramWriter(message_loop)) { 21 buffered_rtp_writer_(new BufferedDatagramWriter(message_loop)) {
22 } 22 }
23 23
24 RtpWriter::~RtpWriter() { } 24 RtpWriter::~RtpWriter() { }
25 25
26 // Initializes the writer. Must be called on the thread the sockets belong 26 // Initializes the writer. Must be called on the thread the sockets belong
27 // to. 27 // to.
28 void RtpWriter::Init(net::Socket* rtp_socket) { 28 void RtpWriter::Init(net::Socket* rtp_socket) {
29 buffered_rtp_writer_->Init(rtp_socket, NULL); 29 buffered_rtp_writer_->Init(
30 rtp_socket, BufferedSocketWriter::WriteFailedCallback());
30 } 31 }
31 32
32 void RtpWriter::Close() { 33 void RtpWriter::Close() {
33 buffered_rtp_writer_->Close(); 34 buffered_rtp_writer_->Close();
34 } 35 }
35 36
36 void RtpWriter::SendPacket(uint32 timestamp, bool marker, 37 void RtpWriter::SendPacket(uint32 timestamp, bool marker,
37 const Vp8Descriptor& vp8_descriptor, 38 const Vp8Descriptor& vp8_descriptor,
38 const CompoundBuffer& payload) { 39 const CompoundBuffer& payload) {
39 RtpHeader header; 40 RtpHeader header;
(...skipping 26 matching lines...) Expand all
66 // Pack VP8 descriptor. 67 // Pack VP8 descriptor.
67 PackVp8Descriptor(vp8_descriptor, 68 PackVp8Descriptor(vp8_descriptor,
68 reinterpret_cast<uint8*>(buffer->data()) + header_size, 69 reinterpret_cast<uint8*>(buffer->data()) + header_size,
69 vp8_descriptor_size); 70 vp8_descriptor_size);
70 71
71 // Copy payload to the buffer. 72 // Copy payload to the buffer.
72 payload.CopyTo(buffer->data() + header_size + vp8_descriptor_size, 73 payload.CopyTo(buffer->data() + header_size + vp8_descriptor_size,
73 payload_size); 74 payload_size);
74 75
75 // And write the packet. 76 // And write the packet.
76 buffered_rtp_writer_->Write(buffer, NULL); 77 buffered_rtp_writer_->Write(buffer, base::Closure());
77 } 78 }
78 79
79 int RtpWriter::GetPendingPackets() { 80 int RtpWriter::GetPendingPackets() {
80 return buffered_rtp_writer_->GetBufferChunks(); 81 return buffered_rtp_writer_->GetBufferChunks();
81 } 82 }
82 83
83 } // namespace protocol 84 } // namespace protocol
84 } // namespace remoting 85 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698