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

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

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: fix sender app Created 6 years, 10 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 MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ 5 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ 6 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/tick_clock.h" 11 #include "base/time/tick_clock.h"
12 #include "base/time/time.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"
13 #include "media/cast/transport/cast_transport_config.h" 16 #include "media/cast/transport/cast_transport_config.h"
14 #include "media/cast/transport/cast_transport_sender.h" 17 #include "media/cast/transport/cast_transport_sender.h"
15 #include "media/cast/transport/pacing/paced_sender.h" 18 #include "media/cast/transport/pacing/paced_sender.h"
16 #include "media/cast/transport/rtcp/rtcp_builder.h" 19 #include "media/cast/transport/rtcp/rtcp_builder.h"
17 #include "media/cast/transport/transport_audio_sender.h" 20 #include "media/cast/transport/transport_audio_sender.h"
18 #include "media/cast/transport/transport_video_sender.h" 21 #include "media/cast/transport/transport_video_sender.h"
19 22
20 namespace media { 23 namespace media {
21 namespace cast { 24 namespace cast {
22 namespace transport { 25 namespace transport {
23 26
24 class CastTransportSenderImpl : public CastTransportSender { 27 class CastTransportSenderImpl : public CastTransportSender {
25 public: 28 public:
26 // external_transport is only used for testing. 29 // external_transport is only used for testing.
27 // Note that SetPacketReceiver does not work if an external 30 // Note that SetPacketReceiver does not work if an external
28 // transport is provided. 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.
29 CastTransportSenderImpl( 37 CastTransportSenderImpl(
30 net::NetLog* net_log, 38 net::NetLog* net_log,
31 base::TickClock* clock, 39 base::TickClock* clock,
32 const CastTransportConfig& config, 40 const CastTransportConfig& config,
41 const CastLoggingConfig& logging_config,
33 const CastTransportStatusCallback& status_callback, 42 const CastTransportStatusCallback& status_callback,
43 const BulkRawEventsCallback& raw_events_callback,
44 base::TimeDelta raw_events_callback_interval,
34 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, 45 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner,
35 PacketSender* external_transport); 46 PacketSender* external_transport);
36 47
37 virtual ~CastTransportSenderImpl(); 48 virtual ~CastTransportSenderImpl();
38 49
39 // CastTransportSender implementation. 50 // CastTransportSender implementation.
40 virtual void SetPacketReceiver(const PacketReceiverCallback& packet_receiver) 51 virtual void SetPacketReceiver(const PacketReceiverCallback& packet_receiver)
41 OVERRIDE; 52 OVERRIDE;
42 53
43 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame, 54 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame,
(...skipping 15 matching lines...) Expand all
59 const MissingFramesAndPacketsMap& missing_packets) 70 const MissingFramesAndPacketsMap& missing_packets)
60 OVERRIDE; 71 OVERRIDE;
61 72
62 virtual void SubscribeAudioRtpStatsCallback( 73 virtual void SubscribeAudioRtpStatsCallback(
63 const CastTransportRtpStatistics& callback) OVERRIDE; 74 const CastTransportRtpStatistics& callback) OVERRIDE;
64 75
65 virtual void SubscribeVideoRtpStatsCallback( 76 virtual void SubscribeVideoRtpStatsCallback(
66 const CastTransportRtpStatistics& callback) OVERRIDE; 77 const CastTransportRtpStatistics& callback) OVERRIDE;
67 78
68 private: 79 private:
80 // If raw events logging is enabled, this is called periodically.
81 // Calls |raw_events_callback_| with events collected by |event_subscriber_|
82 // since last call.
83 void SendRawEvents();
84
69 scoped_ptr<UdpTransport> transport_; 85 scoped_ptr<UdpTransport> transport_;
70 PacedSender pacer_; 86 PacedSender pacer_;
71 RtcpBuilder rtcp_builder_; 87 RtcpBuilder rtcp_builder_;
72 TransportAudioSender audio_sender_; 88 TransportAudioSender audio_sender_;
73 TransportVideoSender video_sender_; 89 TransportVideoSender video_sender_;
74 90
91 LoggingImpl logging_;
92
93 // This is non-null iff raw events logging is enabled.
94 scoped_ptr<SimpleEventSubscriber> event_subscriber_;
95 base::RepeatingTimer<CastTransportSenderImpl> raw_events_timer_;
96
97 BulkRawEventsCallback raw_events_callback_;
98
75 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); 99 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl);
76 }; 100 };
77 101
78 } // namespace transport 102 } // namespace transport
79 } // namespace cast 103 } // namespace cast
80 } // namespace media 104 } // namespace media
81 105
82 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ 106 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698