OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This is the main interface for the cast net sender. The cast sender handles | 5 // This is the main interface for the cast net sender. The cast sender handles |
6 // the cast pipeline from encoded frames (both audio and video), to encryption, | 6 // the cast pipeline from encoded frames (both audio and video), to encryption, |
7 // packetization and transport. | 7 // packetization and transport. |
8 // All configurations are done at creation. | 8 // All configurations are done at creation. |
9 | 9 |
10 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ | 10 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ |
11 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ | 11 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "base/time/tick_clock.h" | 15 #include "base/time/tick_clock.h" |
16 #include "media/cast/net/cast_transport_defines.h" | 16 #include "media/cast/transport/cast_transport_defines.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 class AudioBus; | 19 class AudioBus; |
20 class VideoFrame; | 20 class VideoFrame; |
21 } | 21 } |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 namespace cast { | 24 namespace cast { |
25 namespace transport { | 25 namespace transport { |
26 | 26 |
27 class CastNetNotification { | 27 typedef base::Callback<void(CastTransportStatus status)> |
28 public: | 28 CastTransportStatusCallback; |
29 enum CastNetStatus { | |
30 UNINITIALIZED, | |
31 INITIALIZED, | |
32 INVALID_CRYPTO_CONFIG, | |
33 SOCKET_ERROR, | |
34 // TODO(mikhal): Add. | |
35 }; | |
36 | |
37 virtual void NotifyStatusChange(CastNetStatus result) = 0; | |
38 virtual ~CastNetNotification() {} | |
39 }; | |
40 | 29 |
41 // This Class is not thread safe. | 30 // This Class is not thread safe. |
42 // The application should only trigger this class from one thread. | 31 // The application should only trigger this class from one thread. |
43 class CastNetSender : public base::NonThreadSafe { | 32 class CastTransportSender : public base::NonThreadSafe { |
hubbe
2013/12/27 23:49:58
Since this is an interface, please make sure to do
mikhal1
2013/12/30 17:33:46
Done.
| |
44 public: | 33 public: |
45 static CastNetSender* CreateCastNetSender( | 34 static CastTransportSender* CreateCastNetSender( |
46 base::TickClock* clock, | 35 base::TickClock* clock, |
47 const CastNetConfig& config, | 36 const CastTransportConfig& config, |
48 CastNetNotification* const notifier, | 37 const CastTransportStatusCallback& status_callback, |
49 scoped_refptr<PacketReceiver> packet_receiver); | 38 scoped_refptr<base::TaskRunner> transport_thread); |
50 | 39 |
51 virtual ~CastNetSender() {} | 40 virtual ~CastTransportSender() {} |
52 virtual void InsertCodedAudioFrame(const AudioBus* audio_bus, | 41 |
42 virtual void SetPacketReceiver( | |
43 scoped_refptr<PacketReceiver> packet_receiver) = 0; | |
44 | |
45 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_bus, | |
hubbe
2013/12/27 23:49:58
audio_bus -> audio_frame
mikhal1
2013/12/30 17:33:46
Done.
| |
53 const base::TimeTicks& recorded_time) = 0; | 46 const base::TimeTicks& recorded_time) = 0; |
54 | 47 |
55 virtual void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame, | 48 virtual void InsertCodedVideoFrame(const EncodedVideoFrame* video_frame, |
56 const base::TimeTicks& capture_time) = 0; | 49 const base::TimeTicks& capture_time) = 0; |
57 | 50 |
58 virtual void SendRtcpFromRtpSender( | 51 virtual void SendRtcpFromRtpSender( |
59 uint32 packet_type_flags, | 52 uint32 packet_type_flags, |
60 const RtcpSenderInfo& sender_info, | 53 const RtcpSenderInfo& sender_info, |
61 const RtcpDlrrReportBlock& dlrr, | 54 const RtcpDlrrReportBlock& dlrr, |
62 const RtcpSenderLogMessage& sender_log) = 0; | 55 const RtcpSenderLogMessage& sender_log) = 0; |
63 | 56 |
64 virtual void ResendPackets( | 57 virtual void ResendPackets( |
65 const MissingFramesAndPacketsMap& missing_packets) = 0; | 58 const MissingFramesAndPacketsMap& missing_packets) = 0; |
66 }; | 59 |
60 virtual void RtpAudioStatistics(const base::TimeTicks& now, | |
61 RtcpSenderInfo* sender_info) = 0; | |
62 | |
63 virtual void RtpVideoStatistics(const base::TimeTicks& now, | |
64 RtcpSenderInfo* sender_info) = 0; | |
67 | 65 |
68 } // namespace transport | 66 } // namespace transport |
69 } // namespace cast | 67 } // namespace cast |
70 } // namespace media | 68 } // namespace media |
71 | 69 |
72 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ | 70 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ |
OLD | NEW |