blob: 288fa13bd3ff806d927deb30ca642534c9d879e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_CAST_TEST_TRANSPORT_TRANSPORT_H_
#define MEDIA_CAST_TEST_TRANSPORT_TRANSPORT_H_
#include "base/memory/scoped_ptr.h"
#include "media/cast/cast_config.h"
#include "media/cast/cast_environment.h"
#include "net/udp/udp_server_socket.h"
#include "net/udp/udp_socket.h"
namespace media {
namespace cast {
namespace test {
class LocalUdpTransportData;
class LocalPacketSender;
// Helper class for Cast test applications.
class Transport {
public:
Transport(scoped_refptr<base::TaskRunner> io_thread_proxy);
~Transport();
// Specifies the ports and IP address to receive packets on.
// Will start listening immediately.
void SetLocalReceiver(PacketReceiver* packet_receiver,
std::string ip_address,
std::string local_ip_address,
int port);
// Specifies the destination port and IP address.
void SetSendDestination(std::string ip_address, int port);
PacketSender* packet_sender();
void SetSendSidePacketLoss(int percentage);
void StopReceiving();
private:
scoped_ptr<net::DatagramServerSocket> udp_socket_;
scoped_refptr<LocalPacketSender> packet_sender_;
scoped_refptr<LocalUdpTransportData> local_udp_transport_data_;
scoped_refptr<base::TaskRunner> io_thread_proxy_;
DISALLOW_COPY_AND_ASSIGN(Transport);
};
} // namespace test
} // namespace cast
} // namespace media
#endif // MEDIA_CAST_TEST_TRANSPORT_TRANSPORT_H_
|