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

Unified Diff: media/cast/transport/transport/transport.cc

Issue 100823015: Cast: move net->transport (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updating transport callback Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/transport/transport/transport.h ('k') | media/cast/video_receiver/video_receiver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cast/transport/transport/transport.cc
diff --git a/media/cast/net/transport/transport.cc b/media/cast/transport/transport/transport.cc
similarity index 92%
rename from media/cast/net/transport/transport.cc
rename to media/cast/transport/transport/transport.cc
index f28e8893b8e52053903ae41f90ddd497489f16e1..dfa155a4c72cad8e3cb46f3117e50ae0e5aff560 100644
--- a/media/cast/net/transport/transport.cc
+++ b/media/cast/transport/transport/transport.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "media/cast/net/transport/transport.h"
+#include "media/cast/transport/transport/transport.h"
#include <string>
@@ -13,11 +13,12 @@
#include "base/message_loop/message_loop.h"
#include "base/rand_util.h"
#include "net/base/io_buffer.h"
+#include "net/base/net_errors.h"
#include "net/base/rand_callback.h"
-#include "net/base/test_completion_callback.h"
namespace media {
namespace cast {
+namespace transport {
const int kMaxPacketSize = 1500;
@@ -118,12 +119,20 @@ class LocalPacketSender : public PacketSender,
virtual void SendPacketToNetwork(const Packet& packet) {
DCHECK(io_thread_proxy_->RunsTasksOnCurrentThread());
- const uint8* data = packet.data();
- net::TestCompletionCallback callback;
+ const uint8* data = &packet[0];
scoped_refptr<net::WrappedIOBuffer> buffer(
new net::WrappedIOBuffer(reinterpret_cast<const char*>(data)));
udp_socket_->SendTo(buffer.get(), static_cast<int>(packet.size()),
- send_address_, callback.callback());
+ send_address_,
+ base::Bind(&LocalPacketSender::OnSendCompleted,
+ base::Unretained(this)));
+ }
+
+ virtual void OnSendCompleted(int result) {
+ if (result < 0) {
+ // TODO(mikhal): Add to error messages.
+ VLOG(0) << "Send failed on UDP socket : " << result;
+ }
}
virtual bool SendPackets(const PacketList& packets) OVERRIDE {
@@ -191,5 +200,6 @@ void Transport::SetSendDestination(std::string ip_address, int port) {
packet_sender_->SetSendAddress(send_address);
}
+} // namespace transport
} // namespace cast
} // namespace media
« no previous file with comments | « media/cast/transport/transport/transport.h ('k') | media/cast/video_receiver/video_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698