| 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 #include "chrome/browser/media/cast_transport_host_filter.h" | 5 #include "chrome/browser/media/cast_transport_host_filter.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/net/chrome_net_log.h" | 8 #include "chrome/browser/net/chrome_net_log.h" |
| 9 #include "media/cast/transport/cast_transport_sender.h" | 9 #include "media/cast/transport/cast_transport_sender.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 // How often to send raw events. | 13 // How often to send raw events. |
| 14 const int kSendRawEventsIntervalSecs = 1; | 14 const int kSendRawEventsIntervalSecs = 1; |
| 15 | 15 |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace cast { | 18 namespace cast { |
| 19 | 19 |
| 20 CastTransportHostFilter::CastTransportHostFilter() | 20 CastTransportHostFilter::CastTransportHostFilter() |
| 21 : BrowserMessageFilter(CastMsgStart) {} | 21 : BrowserMessageFilter(CastMsgStart) {} |
| 22 | 22 |
| 23 CastTransportHostFilter::~CastTransportHostFilter() {} | 23 CastTransportHostFilter::~CastTransportHostFilter() {} |
| 24 | 24 |
| 25 bool CastTransportHostFilter::OnMessageReceived(const IPC::Message& message, | 25 bool CastTransportHostFilter::OnMessageReceived(const IPC::Message& message) { |
| 26 bool* message_was_ok) { | |
| 27 bool handled = true; | 26 bool handled = true; |
| 28 IPC_BEGIN_MESSAGE_MAP_EX(CastTransportHostFilter, message, *message_was_ok) | 27 IPC_BEGIN_MESSAGE_MAP(CastTransportHostFilter, message) |
| 29 IPC_MESSAGE_HANDLER(CastHostMsg_New, OnNew) | 28 IPC_MESSAGE_HANDLER(CastHostMsg_New, OnNew) |
| 30 IPC_MESSAGE_HANDLER(CastHostMsg_Delete, OnDelete) | 29 IPC_MESSAGE_HANDLER(CastHostMsg_Delete, OnDelete) |
| 31 IPC_MESSAGE_HANDLER(CastHostMsg_InitializeAudio, OnInitializeAudio) | 30 IPC_MESSAGE_HANDLER(CastHostMsg_InitializeAudio, OnInitializeAudio) |
| 32 IPC_MESSAGE_HANDLER(CastHostMsg_InitializeVideo, OnInitializeVideo) | 31 IPC_MESSAGE_HANDLER(CastHostMsg_InitializeVideo, OnInitializeVideo) |
| 33 IPC_MESSAGE_HANDLER(CastHostMsg_InsertCodedAudioFrame, | 32 IPC_MESSAGE_HANDLER(CastHostMsg_InsertCodedAudioFrame, |
| 34 OnInsertCodedAudioFrame) | 33 OnInsertCodedAudioFrame) |
| 35 IPC_MESSAGE_HANDLER(CastHostMsg_InsertCodedVideoFrame, | 34 IPC_MESSAGE_HANDLER(CastHostMsg_InsertCodedVideoFrame, |
| 36 OnInsertCodedVideoFrame) | 35 OnInsertCodedVideoFrame) |
| 37 IPC_MESSAGE_HANDLER(CastHostMsg_SendRtcpFromRtpSender, | 36 IPC_MESSAGE_HANDLER(CastHostMsg_SendRtcpFromRtpSender, |
| 38 OnSendRtcpFromRtpSender) | 37 OnSendRtcpFromRtpSender) |
| 39 IPC_MESSAGE_HANDLER(CastHostMsg_ResendPackets, | 38 IPC_MESSAGE_HANDLER(CastHostMsg_ResendPackets, |
| 40 OnResendPackets) | 39 OnResendPackets) |
| 41 IPC_MESSAGE_UNHANDLED(handled = false); | 40 IPC_MESSAGE_UNHANDLED(handled = false); |
| 42 IPC_END_MESSAGE_MAP_EX(); | 41 IPC_END_MESSAGE_MAP(); |
| 43 return handled; | 42 return handled; |
| 44 } | 43 } |
| 45 | 44 |
| 46 void CastTransportHostFilter::NotifyStatusChange( | 45 void CastTransportHostFilter::NotifyStatusChange( |
| 47 int32 channel_id, | 46 int32 channel_id, |
| 48 media::cast::transport::CastTransportStatus status) { | 47 media::cast::transport::CastTransportStatus status) { |
| 49 Send(new CastMsg_NotifyStatusChange(channel_id, status)); | 48 Send(new CastMsg_NotifyStatusChange(channel_id, status)); |
| 50 } | 49 } |
| 51 | 50 |
| 52 void CastTransportHostFilter::ReceivedPacket( | 51 void CastTransportHostFilter::ReceivedPacket( |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 id_map_.Lookup(channel_id); | 185 id_map_.Lookup(channel_id); |
| 187 if (sender) { | 186 if (sender) { |
| 188 sender->ResendPackets(is_audio, missing_packets); | 187 sender->ResendPackets(is_audio, missing_packets); |
| 189 } else { | 188 } else { |
| 190 DVLOG(1) | 189 DVLOG(1) |
| 191 << "CastTransportHostFilter::OnResendPackets on non-existing channel"; | 190 << "CastTransportHostFilter::OnResendPackets on non-existing channel"; |
| 192 } | 191 } |
| 193 } | 192 } |
| 194 | 193 |
| 195 } // namespace cast | 194 } // namespace cast |
| OLD | NEW |