Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: chrome/renderer/media/cast_ipc_dispatcher.cc

Issue 178073004: Cast: IPC from browser to renderer to send packet events from transport to cast library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/renderer/media/cast_ipc_dispatcher.h" 5 #include "chrome/renderer/media/cast_ipc_dispatcher.h"
6 6
7 #include "chrome/common/cast_messages.h" 7 #include "chrome/common/cast_messages.h"
8 #include "chrome/renderer/media/cast_transport_sender_ipc.h" 8 #include "chrome/renderer/media/cast_transport_sender_ipc.h"
9 #include "ipc/ipc_message_macros.h" 9 #include "ipc/ipc_message_macros.h"
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return id_map_.Remove(channel_id); 44 return id_map_.Remove(channel_id);
45 } 45 }
46 46
47 bool CastIPCDispatcher::OnMessageReceived(const IPC::Message& message) { 47 bool CastIPCDispatcher::OnMessageReceived(const IPC::Message& message) {
48 DCHECK(io_message_loop_->BelongsToCurrentThread()); 48 DCHECK(io_message_loop_->BelongsToCurrentThread());
49 bool handled = true; 49 bool handled = true;
50 IPC_BEGIN_MESSAGE_MAP(CastIPCDispatcher, message) 50 IPC_BEGIN_MESSAGE_MAP(CastIPCDispatcher, message)
51 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket) 51 IPC_MESSAGE_HANDLER(CastMsg_ReceivedPacket, OnReceivedPacket)
52 IPC_MESSAGE_HANDLER(CastMsg_NotifyStatusChange, OnNotifyStatusChange) 52 IPC_MESSAGE_HANDLER(CastMsg_NotifyStatusChange, OnNotifyStatusChange)
53 IPC_MESSAGE_HANDLER(CastMsg_RtpStatistics, OnRtpStatistics) 53 IPC_MESSAGE_HANDLER(CastMsg_RtpStatistics, OnRtpStatistics)
54 IPC_MESSAGE_HANDLER(CastMsg_RawEvents, OnRawEvents)
54 IPC_MESSAGE_UNHANDLED(handled = false); 55 IPC_MESSAGE_UNHANDLED(handled = false);
55 IPC_END_MESSAGE_MAP(); 56 IPC_END_MESSAGE_MAP();
56 return handled; 57 return handled;
57 } 58 }
58 59
59 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) { 60 void CastIPCDispatcher::OnFilterAdded(IPC::Channel* channel) {
60 DCHECK(io_message_loop_->BelongsToCurrentThread()); 61 DCHECK(io_message_loop_->BelongsToCurrentThread());
61 DCHECK(!global_instance_); 62 DCHECK(!global_instance_);
62 global_instance_ = this; 63 global_instance_ = this;
63 channel_ = channel; 64 channel_ = channel;
(...skipping 11 matching lines...) Expand all
75 DCHECK_EQ(this, global_instance_); 76 DCHECK_EQ(this, global_instance_);
76 } 77 }
77 78
78 void CastIPCDispatcher::OnReceivedPacket( 79 void CastIPCDispatcher::OnReceivedPacket(
79 int32 channel_id, 80 int32 channel_id,
80 const media::cast::transport::Packet& packet) { 81 const media::cast::transport::Packet& packet) {
81 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); 82 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id);
82 if (sender) { 83 if (sender) {
83 sender->OnReceivedPacket(packet); 84 sender->OnReceivedPacket(packet);
84 } else { 85 } else {
85 LOG(ERROR) << "CastIPCDispatcher::OnReceivedPacket " 86 DVLOG(1) << "CastIPCDispatcher::OnReceivedPacket "
86 << "on non-existing channel."; 87 << "on non-existing channel.";
87 } 88 }
88 } 89 }
89 90
90 void CastIPCDispatcher::OnNotifyStatusChange( 91 void CastIPCDispatcher::OnNotifyStatusChange(
91 int32 channel_id, 92 int32 channel_id,
92 media::cast::transport::CastTransportStatus status) { 93 media::cast::transport::CastTransportStatus status) {
93 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); 94 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id);
94 if (sender) { 95 if (sender) {
95 sender->OnNotifyStatusChange(status); 96 sender->OnNotifyStatusChange(status);
96 } else { 97 } else {
97 LOG(ERROR) 98 DVLOG(1)
98 << "CastIPCDispatcher::OnNotifystatusChange on non-existing channel."; 99 << "CastIPCDispatcher::OnNotifystatusChange on non-existing channel.";
99 } 100 }
100 } 101 }
101 102
102 void CastIPCDispatcher::OnRtpStatistics( 103 void CastIPCDispatcher::OnRtpStatistics(
103 int32 channel_id, 104 int32 channel_id,
104 bool audio, 105 bool audio,
105 const media::cast::transport::RtcpSenderInfo& sender_info, 106 const media::cast::transport::RtcpSenderInfo& sender_info,
106 base::TimeTicks time_sent, 107 base::TimeTicks time_sent,
107 uint32 rtp_timestamp) { 108 uint32 rtp_timestamp) {
108 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id); 109 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id);
109 if (sender) { 110 if (sender) {
110 sender->OnRtpStatistics(audio, sender_info, time_sent, rtp_timestamp); 111 sender->OnRtpStatistics(audio, sender_info, time_sent, rtp_timestamp);
111 } else { 112 } else {
112 LOG(ERROR) 113 DVLOG(1) << "CastIPCDispatcher::OnRtpStatistics on non-existing channel.";
113 << "CastIPCDispatcher::OnNotifystatusChange on non-existing channel.";
114 } 114 }
115 } 115 }
116
117 void CastIPCDispatcher::OnRawEvents(
118 int32 channel_id,
119 const std::vector<media::cast::PacketEvent>& packet_events) {
120 CastTransportSenderIPC* sender = id_map_.Lookup(channel_id);
121 if (sender) {
122 sender->OnRawEvents(packet_events);
123 } else {
124 DVLOG(1) << "CastIPCDispatcher::OnRawEvents on non-existing channel.";
125 }
126 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_ipc_dispatcher.h ('k') | chrome/renderer/media/cast_session_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698