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

Side by Side Diff: chrome/renderer/media/cast_transport_ipc.h

Issue 1878883003: Refactor: simplify interface of SenderRtcpSession and CastTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #ifndef CHROME_RENDERER_MEDIA_CAST_TRANSPORT_IPC_H_ 5 #ifndef CHROME_RENDERER_MEDIA_CAST_TRANSPORT_IPC_H_
6 #define CHROME_RENDERER_MEDIA_CAST_TRANSPORT_IPC_H_ 6 #define CHROME_RENDERER_MEDIA_CAST_TRANSPORT_IPC_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "ipc/ipc_channel_proxy.h" 14 #include "ipc/ipc_channel_proxy.h"
15 #include "media/cast/logging/logging_defines.h" 15 #include "media/cast/logging/logging_defines.h"
16 #include "media/cast/net/cast_transport.h" 16 #include "media/cast/net/cast_transport.h"
17 17
18 // This implementation of the CastTransport interface communicates with the 18 // This implementation of the CastTransport interface communicates with the
19 // browser process over IPC and relays all calls to/from the cast transport to 19 // browser process over IPC and relays all calls to/from the cast transport to
20 // the browser process. The primary reason for this arrangement is to give the 20 // the browser process. The primary reason for this arrangement is to give the
21 // renderer less direct control over the UDP sockets. 21 // renderer less direct control over the UDP sockets.
22 class CastTransportIPC : public media::cast::CastTransport { 22 class CastTransportIPC : public media::cast::CastTransport {
23 public: 23 public:
24 CastTransportIPC(const net::IPEndPoint& local_end_point, 24 CastTransportIPC(const net::IPEndPoint& local_end_point,
25 const net::IPEndPoint& remote_end_point, 25 const net::IPEndPoint& remote_end_point,
26 scoped_ptr<base::DictionaryValue> options, 26 std::unique_ptr<base::DictionaryValue> options,
27 const media::cast::PacketReceiverCallback& packet_callback, 27 const media::cast::PacketReceiverCallback& packet_callback,
28 const media::cast::CastTransportStatusCallback& status_cb, 28 const media::cast::CastTransportStatusCallback& status_cb,
29 const media::cast::BulkRawEventsCallback& raw_events_cb); 29 const media::cast::BulkRawEventsCallback& raw_events_cb);
30 30
31 ~CastTransportIPC() override; 31 ~CastTransportIPC() override;
32 32
33 // media::cast::CastTransport implementation. 33 // media::cast::CastTransport implementation.
34 void InitializeAudio( 34 void InitializeAudio(
35 const media::cast::CastTransportRtpConfig& config, 35 const media::cast::CastTransportRtpConfig& config,
36 const media::cast::RtcpCastMessageCallback& cast_message_cb, 36 std::unique_ptr<media::cast::RtpSenderRtcpClient> rtcp_client) override;
37 const media::cast::RtcpRttCallback& rtt_cb,
38 const media::cast::RtcpPliCallback& pli_cb) override;
39 void InitializeVideo( 37 void InitializeVideo(
40 const media::cast::CastTransportRtpConfig& config, 38 const media::cast::CastTransportRtpConfig& config,
41 const media::cast::RtcpCastMessageCallback& cast_message_cb, 39 std::unique_ptr<media::cast::RtpSenderRtcpClient> rtcp_client) override;
42 const media::cast::RtcpRttCallback& rtt_cb,
43 const media::cast::RtcpPliCallback& pli_cb) override;
44 void InsertFrame(uint32_t ssrc, 40 void InsertFrame(uint32_t ssrc,
45 const media::cast::EncodedFrame& frame) override; 41 const media::cast::EncodedFrame& frame) override;
46 void SendSenderReport( 42 void SendSenderReport(
47 uint32_t ssrc, 43 uint32_t ssrc,
48 base::TimeTicks current_time, 44 base::TimeTicks current_time,
49 media::cast::RtpTimeTicks current_time_as_rtp_timestamp) override; 45 media::cast::RtpTimeTicks current_time_as_rtp_timestamp) override;
50 void CancelSendingFrames(uint32_t ssrc, 46 void CancelSendingFrames(uint32_t ssrc,
51 const std::vector<uint32_t>& frame_ids) override; 47 const std::vector<uint32_t>& frame_ids) override;
52 void ResendFrameForKickstart(uint32_t ssrc, uint32_t frame_id) override; 48 void ResendFrameForKickstart(uint32_t ssrc, uint32_t frame_id) override;
53 void AddValidRtpReceiver(uint32_t rtp_sender_ssrc, 49 void AddValidRtpReceiver(uint32_t rtp_sender_ssrc,
(...skipping 13 matching lines...) Expand all
67 void OnNotifyStatusChange(media::cast::CastTransportStatus status); 63 void OnNotifyStatusChange(media::cast::CastTransportStatus status);
68 void OnRawEvents(const std::vector<media::cast::PacketEvent>& packet_events, 64 void OnRawEvents(const std::vector<media::cast::PacketEvent>& packet_events,
69 const std::vector<media::cast::FrameEvent>& frame_events); 65 const std::vector<media::cast::FrameEvent>& frame_events);
70 void OnRtt(uint32_t rtp_sender_ssrc, base::TimeDelta rtt); 66 void OnRtt(uint32_t rtp_sender_ssrc, base::TimeDelta rtt);
71 void OnRtcpCastMessage(uint32_t rtp_sender_ssrc, 67 void OnRtcpCastMessage(uint32_t rtp_sender_ssrc,
72 const media::cast::RtcpCastMessage& cast_message); 68 const media::cast::RtcpCastMessage& cast_message);
73 void OnReceivedPli(uint32_t rtp_sender_ssrc); 69 void OnReceivedPli(uint32_t rtp_sender_ssrc);
74 void OnReceivedPacket(const media::cast::Packet& packet); 70 void OnReceivedPacket(const media::cast::Packet& packet);
75 71
76 private: 72 private:
77 struct ClientCallbacks {
78 ClientCallbacks();
79 ClientCallbacks(const ClientCallbacks& other);
80 ~ClientCallbacks();
81
82 media::cast::RtcpCastMessageCallback cast_message_cb;
83 media::cast::RtcpRttCallback rtt_cb;
84 media::cast::RtcpPliCallback pli_cb;
85 };
86
87 void Send(IPC::Message* message); 73 void Send(IPC::Message* message);
88 74
89 int32_t channel_id_; 75 int32_t channel_id_;
90 media::cast::PacketReceiverCallback packet_callback_; 76 media::cast::PacketReceiverCallback packet_callback_;
91 media::cast::CastTransportStatusCallback status_callback_; 77 media::cast::CastTransportStatusCallback status_callback_;
92 media::cast::BulkRawEventsCallback raw_events_callback_; 78 media::cast::BulkRawEventsCallback raw_events_callback_;
93 typedef std::map<uint32_t, ClientCallbacks> ClientMap; 79 typedef std::map<uint32_t, std::unique_ptr<media::cast::RtpSenderRtcpClient>>
miu 2016/04/15 23:14:39 nit: Since you're changing this line, please use t
xjz 2016/04/20 01:09:02 Done.
80 ClientMap;
94 ClientMap clients_; 81 ClientMap clients_;
95 82
96 DISALLOW_COPY_AND_ASSIGN(CastTransportIPC); 83 DISALLOW_COPY_AND_ASSIGN(CastTransportIPC);
97 }; 84 };
98 85
99 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_IPC_H_ 86 #endif // CHROME_RENDERER_MEDIA_CAST_TRANSPORT_IPC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698