NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / renderer / media / cast_ipc_dispatcher.h
blob7464f4d14d6c8cdc8e4a8dac085ab9f2777430d5
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
3 // found in the LICENSE file.
5 #ifndef CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_
6 #define CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_
8 #include "base/callback.h"
9 #include "base/id_map.h"
10 #include "ipc/ipc_channel_proxy.h"
11 #include "media/cast/cast_sender.h"
12 #include "media/cast/transport/cast_transport_sender.h"
14 class CastTransportSenderIPC;
16 // This dispatcher listens to incoming IPC messages and sends
17 // the call to the correct CastTransportSenderIPC instance.
18 class CastIPCDispatcher : public IPC::ChannelProxy::MessageFilter {
19 public:
20 explicit CastIPCDispatcher(
21 const scoped_refptr<base::MessageLoopProxy>& io_message_loop);
23 static CastIPCDispatcher* Get();
24 void Send(IPC::Message* message);
25 int32 AddSender(CastTransportSenderIPC* sender);
26 void RemoveSender(int32 channel_id);
28 // IPC::ChannelProxy::MessageFilter implementation
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
30 virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE;
31 virtual void OnFilterRemoved() OVERRIDE;
32 virtual void OnChannelClosing() OVERRIDE;
34 protected:
35 virtual ~CastIPCDispatcher();
37 private:
38 void OnReceivedPacket(int32 channel_id, const media::cast::Packet& packet);
39 void OnNotifyStatusChange(
40 int32 channel_id,
41 media::cast::transport::CastTransportStatus status);
42 void OnRtpStatistics(
43 int32 channel_id,
44 bool audio,
45 const media::cast::transport::RtcpSenderInfo& sender_info,
46 base::TimeTicks time_sent,
47 uint32 rtp_timestamp);
49 static CastIPCDispatcher* global_instance_;
51 // IPC channel for Send(); must only be accesed on |io_message_loop_|.
52 IPC::Channel* channel_;
54 // Message loop on which IPC calls are driven.
55 const scoped_refptr<base::MessageLoopProxy> io_message_loop_;
57 // A map of stream ids to delegates; must only be accessed on
58 // |io_message_loop_|.
59 IDMap<CastTransportSenderIPC> id_map_;
60 DISALLOW_COPY_AND_ASSIGN(CastIPCDispatcher);
63 #endif // CHROME_RENDERER_MEDIA_CAST_IPC_DISPATCHER_H_