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

Side by Side Diff: media/cast/transport/cast_transport_sender_impl.h

Issue 388663003: Cast: Reshuffle files under media/cast (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing includes Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/tick_clock.h"
12 #include "base/time/time.h"
13 #include "base/timer/timer.h"
14 #include "media/cast/logging/logging_defines.h"
15 #include "media/cast/logging/simple_event_subscriber.h"
16 #include "media/cast/transport/cast_transport_config.h"
17 #include "media/cast/transport/cast_transport_sender.h"
18 #include "media/cast/transport/pacing/paced_sender.h"
19 #include "media/cast/transport/rtcp/rtcp_builder.h"
20 #include "media/cast/transport/rtp_sender/rtp_sender.h"
21 #include "media/cast/transport/utility/transport_encryption_handler.h"
22
23 namespace media {
24 namespace cast {
25 namespace transport {
26
27 class CastTransportSenderImpl : public CastTransportSender {
28 public:
29 // external_transport is only used for testing.
30 // Note that SetPacketReceiver does not work if an external
31 // transport is provided.
32 // |raw_events_callback|: Raw events will be returned on this callback
33 // which will be invoked every |raw_events_callback_interval|.
34 // This can be a null callback, i.e. if user is not interested in raw events.
35 // |raw_events_callback_interval|: This can be |base::TimeDelta()| if
36 // |raw_events_callback| is a null callback.
37 CastTransportSenderImpl(
38 net::NetLog* net_log,
39 base::TickClock* clock,
40 const net::IPEndPoint& remote_end_point,
41 const CastTransportStatusCallback& status_callback,
42 const BulkRawEventsCallback& raw_events_callback,
43 base::TimeDelta raw_events_callback_interval,
44 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner,
45 PacketSender* external_transport);
46
47 virtual ~CastTransportSenderImpl();
48
49 virtual void InitializeAudio(const CastTransportRtpConfig& config) OVERRIDE;
50 virtual void InitializeVideo(const CastTransportRtpConfig& config) OVERRIDE;
51
52 // CastTransportSender implementation.
53 virtual void SetPacketReceiver(const PacketReceiverCallback& packet_receiver)
54 OVERRIDE;
55
56 virtual void InsertCodedAudioFrame(const EncodedFrame& audio_frame) OVERRIDE;
57 virtual void InsertCodedVideoFrame(const EncodedFrame& video_frame) OVERRIDE;
58
59 virtual void SendRtcpFromRtpSender(uint32 packet_type_flags,
60 uint32 ntp_seconds,
61 uint32 ntp_fraction,
62 uint32 rtp_timestamp,
63 const RtcpDlrrReportBlock& dlrr,
64 uint32 sending_ssrc,
65 const std::string& c_name) OVERRIDE;
66
67 virtual void ResendPackets(bool is_audio,
68 const MissingFramesAndPacketsMap& missing_packets,
69 bool cancel_rtx_if_not_in_list,
70 base::TimeDelta dedupe_window)
71 OVERRIDE;
72
73 private:
74 // If |raw_events_callback_| is non-null, calls it with events collected
75 // by |event_subscriber_| since last call.
76 void SendRawEvents();
77
78 base::TickClock* clock_; // Not owned by this class.
79 CastTransportStatusCallback status_callback_;
80 scoped_refptr<base::SingleThreadTaskRunner> transport_task_runner_;
81
82 scoped_ptr<UdpTransport> transport_;
83 LoggingImpl logging_;
84 PacedSender pacer_;
85 RtcpBuilder rtcp_builder_;
86 scoped_ptr<RtpSender> audio_sender_;
87 scoped_ptr<RtpSender> video_sender_;
88
89 // Encrypts data in EncodedFrames before they are sent. Note that it's
90 // important for the encryption to happen here, in code that would execute in
91 // the main browser process, for security reasons. This helps to mitigate
92 // the damage that could be caused by a compromised renderer process.
93 TransportEncryptionHandler audio_encryptor_;
94 TransportEncryptionHandler video_encryptor_;
95
96 // This is non-null iff |raw_events_callback_| is non-null.
97 scoped_ptr<SimpleEventSubscriber> event_subscriber_;
98 base::RepeatingTimer<CastTransportSenderImpl> raw_events_timer_;
99
100 BulkRawEventsCallback raw_events_callback_;
101
102 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl);
103 };
104
105 } // namespace transport
106 } // namespace cast
107 } // namespace media
108
109 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
OLDNEW
« no previous file with comments | « media/cast/transport/cast_transport_sender.h ('k') | media/cast/transport/cast_transport_sender_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698