OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ | 5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ |
6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ | 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/time/tick_clock.h" | 11 #include "base/time/tick_clock.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "media/cast/transport/cast_transport_config.h" | 13 #include "media/cast/transport/cast_transport_config.h" |
14 #include "media/cast/transport/cast_transport_sender.h" | 14 #include "media/cast/transport/cast_transport_sender.h" |
15 #include "media/cast/transport/pacing/paced_sender.h" | 15 #include "media/cast/transport/pacing/paced_sender.h" |
16 #include "media/cast/transport/rtcp/rtcp_builder.h" | 16 #include "media/cast/transport/rtcp/rtcp_builder.h" |
17 #include "media/cast/transport/transport_audio_sender.h" | 17 #include "media/cast/transport/transport_audio_sender.h" |
18 #include "media/cast/transport/transport_video_sender.h" | 18 #include "media/cast/transport/transport_video_sender.h" |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 namespace cast { | 21 namespace cast { |
22 namespace transport { | 22 namespace transport { |
23 | 23 |
24 class CastTransportSenderImpl : public CastTransportSender { | 24 class CastTransportSenderImpl : public CastTransportSender { |
25 public: | 25 public: |
| 26 // external_transport is only used for testing. |
| 27 // Note that SetPacketReceiver does not work if an external |
| 28 // transport is provided. |
26 CastTransportSenderImpl( | 29 CastTransportSenderImpl( |
27 base::TickClock* clock, | 30 base::TickClock* clock, |
28 const CastTransportConfig& config, | 31 const CastTransportConfig& config, |
29 const CastTransportStatusCallback& status_callback, | 32 const CastTransportStatusCallback& status_callback, |
30 const scoped_refptr<base::TaskRunner>& transport_task_runner); | 33 const scoped_refptr<base::TaskRunner>& transport_task_runner, |
| 34 PacketSender* external_transport); |
31 | 35 |
32 virtual ~CastTransportSenderImpl(); | 36 virtual ~CastTransportSenderImpl(); |
33 | 37 |
34 // CastTransportSender implementation. | 38 // CastTransportSender implementation. |
35 virtual void | 39 virtual void |
36 SetPacketReceiver(const PacketReceiverCallback& packet_receiver) OVERRIDE; | 40 SetPacketReceiver(const PacketReceiverCallback& packet_receiver) OVERRIDE; |
37 | 41 |
38 virtual void InsertCodedAudioFrame( | 42 virtual void InsertCodedAudioFrame( |
39 const EncodedAudioFrame* audio_frame, | 43 const EncodedAudioFrame* audio_frame, |
40 const base::TimeTicks& recorded_time) OVERRIDE; | 44 const base::TimeTicks& recorded_time) OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
54 virtual void ResendPackets( | 58 virtual void ResendPackets( |
55 bool is_audio, | 59 bool is_audio, |
56 const MissingFramesAndPacketsMap& missing_packets) OVERRIDE; | 60 const MissingFramesAndPacketsMap& missing_packets) OVERRIDE; |
57 | 61 |
58 virtual void RtpAudioStatistics(const base::TimeTicks& now, | 62 virtual void RtpAudioStatistics(const base::TimeTicks& now, |
59 RtcpSenderInfo* sender_info) OVERRIDE; | 63 RtcpSenderInfo* sender_info) OVERRIDE; |
60 | 64 |
61 virtual void RtpVideoStatistics(const base::TimeTicks& now, | 65 virtual void RtpVideoStatistics(const base::TimeTicks& now, |
62 RtcpSenderInfo* sender_info) OVERRIDE; | 66 RtcpSenderInfo* sender_info) OVERRIDE; |
63 | 67 |
64 void InsertFakeTransportForTesting(PacketSender* fake_transport); | |
65 | |
66 private: | 68 private: |
| 69 scoped_ptr<UdpTransport> transport_; |
67 PacedSender pacer_; | 70 PacedSender pacer_; |
68 RtcpBuilder rtcp_builder_; | 71 RtcpBuilder rtcp_builder_; |
69 TransportAudioSender audio_sender_; | 72 TransportAudioSender audio_sender_; |
70 TransportVideoSender video_sender_; | 73 TransportVideoSender video_sender_; |
71 | 74 |
72 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); | 75 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); |
73 }; | 76 }; |
74 | 77 |
75 } // namespace transport | 78 } // namespace transport |
76 } // namespace cast | 79 } // namespace cast |
77 } // namespace media | 80 } // namespace media |
78 | 81 |
79 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ | 82 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ |
OLD | NEW |