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 CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ |
6 #define CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ | 6 #define CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
| 9 #include "base/memory/weak_ptr.h" |
9 #include "base/time/default_tick_clock.h" | 10 #include "base/time/default_tick_clock.h" |
10 #include "chrome/common/cast_messages.h" | 11 #include "chrome/common/cast_messages.h" |
11 #include "content/public/browser/browser_message_filter.h" | 12 #include "content/public/browser/browser_message_filter.h" |
12 #include "media/cast/cast_sender.h" | 13 #include "media/cast/cast_sender.h" |
13 #include "media/cast/logging/logging_defines.h" | 14 #include "media/cast/logging/logging_defines.h" |
14 #include "media/cast/net/cast_transport_sender.h" | 15 #include "media/cast/net/cast_transport_sender.h" |
15 | 16 |
16 namespace cast { | 17 namespace cast { |
17 | 18 |
18 class CastTransportHostFilter : public content::BrowserMessageFilter { | 19 class CastTransportHostFilter : public content::BrowserMessageFilter { |
19 public: | 20 public: |
20 CastTransportHostFilter(); | 21 CastTransportHostFilter(); |
21 private: | 22 private: |
22 virtual ~CastTransportHostFilter(); | 23 virtual ~CastTransportHostFilter(); |
23 | 24 |
24 void NotifyStatusChange( | 25 void NotifyStatusChange( |
25 int32 channel_id, | 26 int32 channel_id, |
26 media::cast::CastTransportStatus result); | 27 media::cast::CastTransportStatus result); |
27 void ReceivedPacket( | 28 void SendRawEvents( |
28 int32 channel_id, | 29 int32 channel_id, |
29 scoped_ptr<media::cast::Packet> result); | 30 const std::vector<media::cast::PacketEvent>& packet_events, |
30 void RawEvents(int32 channel_id, | 31 const std::vector<media::cast::FrameEvent>& frame_events); |
31 const std::vector<media::cast::PacketEvent>& packet_events); | 32 void SendRtt(int32 channel_id, |
| 33 uint32 ssrc, |
| 34 base::TimeDelta rtt, |
| 35 base::TimeDelta avg_rtt, |
| 36 base::TimeDelta min_rtt, |
| 37 base::TimeDelta max_rtt); |
| 38 void SendCastMessage(int32 channel_id, |
| 39 uint32 ssrc, |
| 40 const media::cast::RtcpCastMessage& cast_message); |
32 | 41 |
33 // BrowserMessageFilter implementation. | 42 // BrowserMessageFilter implementation. |
34 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 43 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
35 | 44 |
36 // Forwarding functions. | 45 // Forwarding functions. |
37 void OnInitializeAudio( | 46 void OnInitializeAudio( |
38 int32 channel_id, | 47 int32 channel_id, |
39 const media::cast::CastTransportRtpConfig& config); | 48 const media::cast::CastTransportRtpConfig& config); |
40 void OnInitializeVideo( | 49 void OnInitializeVideo( |
41 int32 channel_id, | 50 int32 channel_id, |
42 const media::cast::CastTransportRtpConfig& config); | 51 const media::cast::CastTransportRtpConfig& config); |
43 void OnInsertCodedAudioFrame( | 52 void OnInsertCodedAudioFrame( |
44 int32 channel_id, | 53 int32 channel_id, |
45 const media::cast::EncodedFrame& audio_frame); | 54 const media::cast::EncodedFrame& audio_frame); |
46 void OnInsertCodedVideoFrame( | 55 void OnInsertCodedVideoFrame( |
47 int32 channel_id, | 56 int32 channel_id, |
48 const media::cast::EncodedFrame& video_frame); | 57 const media::cast::EncodedFrame& video_frame); |
49 void OnSendRtcpFromRtpSender( | 58 void OnSendSenderReport( |
50 int32 channel_id, | 59 int32 channel_id, |
51 const media::cast::SendRtcpFromRtpSenderData& data, | 60 uint32 ssrc, |
52 const media::cast::RtcpDlrrReportBlock& dlrr); | 61 base::TimeTicks current_time, |
| 62 uint32 current_time_as_rtp_timestamp); |
53 void OnResendPackets( | 63 void OnResendPackets( |
54 int32 channel_id, | 64 int32 channel_id, |
55 bool is_audio, | 65 bool is_audio, |
56 const media::cast::MissingFramesAndPacketsMap& missing_packets, | 66 const media::cast::MissingFramesAndPacketsMap& missing_packets, |
57 bool cancel_rtx_if_not_in_list, | 67 bool cancel_rtx_if_not_in_list, |
58 base::TimeDelta dedupe_window); | 68 base::TimeDelta dedupe_window); |
59 void OnNew( | 69 void OnNew( |
60 int32 channel_id, | 70 int32 channel_id, |
61 const net::IPEndPoint& remote_end_point); | 71 const net::IPEndPoint& remote_end_point); |
62 void OnDelete(int32 channel_id); | 72 void OnDelete(int32 channel_id); |
63 | 73 |
64 IDMap<media::cast::CastTransportSender, IDMapOwnPointer> id_map_; | 74 IDMap<media::cast::CastTransportSender, IDMapOwnPointer> id_map_; |
65 | 75 |
66 // Clock used by Cast transport. | 76 // Clock used by Cast transport. |
67 base::DefaultTickClock clock_; | 77 base::DefaultTickClock clock_; |
68 | 78 |
| 79 base::WeakPtrFactory<CastTransportHostFilter> weak_factory_; |
| 80 |
69 DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter); | 81 DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter); |
70 }; | 82 }; |
71 | 83 |
72 } // namespace cast | 84 } // namespace cast |
73 | 85 |
74 #endif // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ | 86 #endif // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ |
OLD | NEW |