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 <stdint.h> |
| 9 |
8 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| 11 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
11 #include "base/time/default_tick_clock.h" | 14 #include "base/time/default_tick_clock.h" |
12 #include "content/public/browser/browser_message_filter.h" | 15 #include "content/public/browser/browser_message_filter.h" |
13 #include "media/cast/cast_sender.h" | 16 #include "media/cast/cast_sender.h" |
14 #include "media/cast/logging/logging_defines.h" | 17 #include "media/cast/logging/logging_defines.h" |
15 #include "media/cast/net/cast_transport_sender.h" | 18 #include "media/cast/net/cast_transport_sender.h" |
16 | 19 |
17 namespace content { | 20 namespace content { |
18 class PowerSaveBlocker; | 21 class PowerSaveBlocker; |
19 } // namespace content | 22 } // namespace content |
20 | 23 |
21 namespace cast { | 24 namespace cast { |
22 | 25 |
23 class CastTransportHostFilter : public content::BrowserMessageFilter { | 26 class CastTransportHostFilter : public content::BrowserMessageFilter { |
24 public: | 27 public: |
25 CastTransportHostFilter(); | 28 CastTransportHostFilter(); |
26 | 29 |
27 private: | 30 private: |
28 ~CastTransportHostFilter() override; | 31 ~CastTransportHostFilter() override; |
29 | 32 |
30 void NotifyStatusChange( | 33 void NotifyStatusChange(int32_t channel_id, |
31 int32 channel_id, | 34 media::cast::CastTransportStatus result); |
32 media::cast::CastTransportStatus result); | |
33 void SendRawEvents( | 35 void SendRawEvents( |
34 int32 channel_id, | 36 int32_t channel_id, |
35 scoped_ptr<std::vector<media::cast::FrameEvent>> frame_events, | 37 scoped_ptr<std::vector<media::cast::FrameEvent>> frame_events, |
36 scoped_ptr<std::vector<media::cast::PacketEvent>> packet_events); | 38 scoped_ptr<std::vector<media::cast::PacketEvent>> packet_events); |
37 void SendRtt(int32 channel_id, uint32 ssrc, base::TimeDelta rtt); | 39 void SendRtt(int32_t channel_id, uint32_t ssrc, base::TimeDelta rtt); |
38 void SendCastMessage(int32 channel_id, | 40 void SendCastMessage(int32_t channel_id, |
39 uint32 ssrc, | 41 uint32_t ssrc, |
40 const media::cast::RtcpCastMessage& cast_message); | 42 const media::cast::RtcpCastMessage& cast_message); |
41 void ReceivedPacket(int32 channel_id, scoped_ptr<media::cast::Packet> packet); | 43 void ReceivedPacket(int32_t channel_id, |
| 44 scoped_ptr<media::cast::Packet> packet); |
42 | 45 |
43 // BrowserMessageFilter implementation. | 46 // BrowserMessageFilter implementation. |
44 bool OnMessageReceived(const IPC::Message& message) override; | 47 bool OnMessageReceived(const IPC::Message& message) override; |
45 | 48 |
46 // Forwarding functions. | 49 // Forwarding functions. |
47 void OnInitializeAudio( | 50 void OnInitializeAudio(int32_t channel_id, |
48 int32 channel_id, | 51 const media::cast::CastTransportRtpConfig& config); |
49 const media::cast::CastTransportRtpConfig& config); | 52 void OnInitializeVideo(int32_t channel_id, |
50 void OnInitializeVideo( | 53 const media::cast::CastTransportRtpConfig& config); |
51 int32 channel_id, | 54 void OnInsertFrame(int32_t channel_id, |
52 const media::cast::CastTransportRtpConfig& config); | 55 uint32_t ssrc, |
53 void OnInsertFrame( | 56 const media::cast::EncodedFrame& frame); |
54 int32 channel_id, | 57 void OnSendSenderReport(int32_t channel_id, |
55 uint32 ssrc, | 58 uint32_t ssrc, |
56 const media::cast::EncodedFrame& frame); | 59 base::TimeTicks current_time, |
57 void OnSendSenderReport( | 60 uint32_t current_time_as_rtp_timestamp); |
58 int32 channel_id, | 61 void OnCancelSendingFrames(int32_t channel_id, |
59 uint32 ssrc, | 62 uint32_t ssrc, |
60 base::TimeTicks current_time, | 63 const std::vector<uint32_t>& frame_ids); |
61 uint32 current_time_as_rtp_timestamp); | 64 void OnResendFrameForKickstart(int32_t channel_id, |
62 void OnCancelSendingFrames(int32 channel_id, uint32 ssrc, | 65 uint32_t ssrc, |
63 const std::vector<uint32>& frame_ids); | 66 uint32_t frame_id); |
64 void OnResendFrameForKickstart(int32 channel_id, uint32 ssrc, | 67 void OnAddValidSsrc(int32_t channel_id, uint32_t ssrc); |
65 uint32 frame_id); | |
66 void OnAddValidSsrc(int32 channel_id, uint32 ssrc); | |
67 void OnSendRtcpFromRtpReceiver( | 68 void OnSendRtcpFromRtpReceiver( |
68 int32 channel_id, | 69 int32_t channel_id, |
69 const media::cast::SendRtcpFromRtpReceiver_Params& params); | 70 const media::cast::SendRtcpFromRtpReceiver_Params& params); |
70 | 71 |
71 void OnNew( | 72 void OnNew(int32_t channel_id, |
72 int32 channel_id, | 73 const net::IPEndPoint& local_end_point, |
73 const net::IPEndPoint& local_end_point, | 74 const net::IPEndPoint& remote_end_point, |
74 const net::IPEndPoint& remote_end_point, | 75 const base::DictionaryValue& options); |
75 const base::DictionaryValue& options); | 76 void OnDelete(int32_t channel_id); |
76 void OnDelete(int32 channel_id); | |
77 | 77 |
78 IDMap<media::cast::CastTransportSender, IDMapOwnPointer> id_map_; | 78 IDMap<media::cast::CastTransportSender, IDMapOwnPointer> id_map_; |
79 | 79 |
80 // Clock used by Cast transport. | 80 // Clock used by Cast transport. |
81 base::DefaultTickClock clock_; | 81 base::DefaultTickClock clock_; |
82 | 82 |
83 // While |id_map_| is non-empty, hold an instance of | 83 // While |id_map_| is non-empty, hold an instance of |
84 // content::PowerSaveBlocker. This prevents Chrome from being suspended while | 84 // content::PowerSaveBlocker. This prevents Chrome from being suspended while |
85 // remoting content. | 85 // remoting content. |
86 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; | 86 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; |
87 | 87 |
88 base::WeakPtrFactory<CastTransportHostFilter> weak_factory_; | 88 base::WeakPtrFactory<CastTransportHostFilter> weak_factory_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter); | 90 DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace cast | 93 } // namespace cast |
94 | 94 |
95 #endif // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ | 95 #endif // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ |
OLD | NEW |