Chromium Code Reviews| 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/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/time/default_tick_clock.h" | 11 #include "base/time/default_tick_clock.h" |
| 12 #include "content/public/browser/browser_message_filter.h" | 12 #include "content/public/browser/browser_message_filter.h" |
| 13 #include "media/cast/cast_sender.h" | 13 #include "media/cast/cast_sender.h" |
| 14 #include "media/cast/logging/logging_defines.h" | 14 #include "media/cast/logging/logging_defines.h" |
| 15 #include "media/cast/net/cast_transport_sender.h" | 15 #include "media/cast/net/cast_transport_sender.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 class PowerSaveBlocker; | 18 class PowerSaveBlocker; |
| 19 } // namespace content | 19 } // namespace content |
| 20 | 20 |
| 21 namespace cast { | 21 namespace cast { |
| 22 | 22 |
| 23 class CastTransportHostFilter : public content::BrowserMessageFilter { | 23 class CastTransportHostFilter |
| 24 : public content::BrowserMessageFilter, | |
| 25 media::cast::CastTransportSender::CastTransportClient { | |
| 24 public: | 26 public: |
| 25 CastTransportHostFilter(); | 27 CastTransportHostFilter(); |
| 26 | 28 |
| 27 private: | 29 private: |
| 28 ~CastTransportHostFilter() override; | 30 ~CastTransportHostFilter() override; |
| 29 | 31 |
| 30 void NotifyStatusChange( | |
| 31 int32 channel_id, | |
| 32 media::cast::CastTransportStatus result); | |
| 33 void SendRawEvents( | |
| 34 int32 channel_id, | |
| 35 scoped_ptr<std::vector<media::cast::FrameEvent>> frame_events, | |
| 36 scoped_ptr<std::vector<media::cast::PacketEvent>> packet_events); | |
| 37 void SendRtt(int32 channel_id, uint32 ssrc, base::TimeDelta rtt); | 32 void SendRtt(int32 channel_id, uint32 ssrc, base::TimeDelta rtt); |
| 38 void SendCastMessage(int32 channel_id, | 33 void SendCastMessage(int32 channel_id, |
| 39 uint32 ssrc, | 34 uint32 ssrc, |
| 40 const media::cast::RtcpCastMessage& cast_message); | 35 const media::cast::RtcpCastMessage& cast_message); |
| 41 void ReceivedPacket(int32 channel_id, scoped_ptr<media::cast::Packet> packet); | |
| 42 | 36 |
| 43 // BrowserMessageFilter implementation. | 37 // BrowserMessageFilter implementation. |
| 44 bool OnMessageReceived(const IPC::Message& message) override; | 38 bool OnMessageReceived(const IPC::Message& message) override; |
| 45 | 39 |
| 40 // Override CastTransportSender::CastTransportClient. | |
|
Irfan
2015/12/16 19:44:34
ha, my suggestion of "CastTransportEndPoint" was f
xjz
2015/12/16 21:58:01
The rename of "CastTransportSender" might in a lat
| |
| 41 void OnStatusChange(media::cast::CastTransportStatus status) final; | |
| 42 void OnReceivedLoggingEvents( | |
| 43 scoped_ptr<std::vector<media::cast::FrameEvent>> frame_events, | |
| 44 scoped_ptr<std::vector<media::cast::PacketEvent>> packet_events) final; | |
| 45 void OnReceivedPackets(scoped_ptr<media::cast::Packet> packet) final; | |
| 46 | |
| 46 // Forwarding functions. | 47 // Forwarding functions. |
| 47 void OnInitializeAudio( | 48 void OnInitializeAudio( |
| 48 int32 channel_id, | 49 int32 channel_id, |
| 49 const media::cast::CastTransportRtpConfig& config); | 50 const media::cast::CastTransportRtpConfig& config); |
| 50 void OnInitializeVideo( | 51 void OnInitializeVideo( |
| 51 int32 channel_id, | 52 int32 channel_id, |
| 52 const media::cast::CastTransportRtpConfig& config); | 53 const media::cast::CastTransportRtpConfig& config); |
| 53 void OnInsertFrame( | 54 void OnInsertFrame( |
| 54 int32 channel_id, | 55 int32 channel_id, |
| 55 uint32 ssrc, | 56 uint32 ssrc, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 78 IDMap<media::cast::CastTransportSender, IDMapOwnPointer> id_map_; | 79 IDMap<media::cast::CastTransportSender, IDMapOwnPointer> id_map_; |
| 79 | 80 |
| 80 // Clock used by Cast transport. | 81 // Clock used by Cast transport. |
| 81 base::DefaultTickClock clock_; | 82 base::DefaultTickClock clock_; |
| 82 | 83 |
| 83 // While |id_map_| is non-empty, hold an instance of | 84 // While |id_map_| is non-empty, hold an instance of |
| 84 // content::PowerSaveBlocker. This prevents Chrome from being suspended while | 85 // content::PowerSaveBlocker. This prevents Chrome from being suspended while |
| 85 // remoting content. | 86 // remoting content. |
| 86 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; | 87 scoped_ptr<content::PowerSaveBlocker> power_save_blocker_; |
| 87 | 88 |
| 89 // Active channel id. | |
| 90 int32 channel_id_; | |
| 91 | |
| 88 base::WeakPtrFactory<CastTransportHostFilter> weak_factory_; | 92 base::WeakPtrFactory<CastTransportHostFilter> weak_factory_; |
| 89 | 93 |
| 90 DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter); | 94 DISALLOW_COPY_AND_ASSIGN(CastTransportHostFilter); |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 } // namespace cast | 97 } // namespace cast |
| 94 | 98 |
| 95 #endif // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ | 99 #endif // CHROME_BROWSER_MEDIA_CAST_TRANSPORT_HOST_FILTER_H_ |
| OLD | NEW |