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

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: Addressed hubbe's comments 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 a regular interval
33 // on this callback.
29 CastTransportSenderImpl( 34 CastTransportSenderImpl(
30 base::TickClock* clock, 35 base::TickClock* clock,
31 const CastTransportConfig& config, 36 const CastTransportConfig& config,
32 const CastTransportStatusCallback& status_callback, 37 const CastTransportStatusCallback& status_callback,
38 const BulkRawEventsCallback& raw_events_callback,
33 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner, 39 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner,
34 PacketSender* external_transport); 40 PacketSender* external_transport);
35 41
36 virtual ~CastTransportSenderImpl(); 42 virtual ~CastTransportSenderImpl();
37 43
38 // CastTransportSender implementation. 44 // CastTransportSender implementation.
39 virtual void SetPacketReceiver(const PacketReceiverCallback& packet_receiver) 45 virtual void SetPacketReceiver(const PacketReceiverCallback& packet_receiver)
40 OVERRIDE; 46 OVERRIDE;
41 47
42 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame, 48 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame,
(...skipping 15 matching lines...) Expand all
58 const MissingFramesAndPacketsMap& missing_packets) 64 const MissingFramesAndPacketsMap& missing_packets)
59 OVERRIDE; 65 OVERRIDE;
60 66
61 virtual void SubscribeAudioRtpStatsCallback( 67 virtual void SubscribeAudioRtpStatsCallback(
62 const CastTransportRtpStatistics& callback) OVERRIDE; 68 const CastTransportRtpStatistics& callback) OVERRIDE;
63 69
64 virtual void SubscribeVideoRtpStatsCallback( 70 virtual void SubscribeVideoRtpStatsCallback(
65 const CastTransportRtpStatistics& callback) OVERRIDE; 71 const CastTransportRtpStatistics& callback) OVERRIDE;
66 72
67 private: 73 private:
74 // How often to send raw events.
75 static const int kSendRawEventsIntervalSecs = 1;
76
77 // If raw events logging is enabled, this is called periodically.
78 // Calls |raw_events_callback_| with events collected by |event_subscriber_|
79 // since last call.
80 void SendRawEvents();
81
68 scoped_ptr<UdpTransport> transport_; 82 scoped_ptr<UdpTransport> transport_;
69 PacedSender pacer_; 83 PacedSender pacer_;
70 RtcpBuilder rtcp_builder_; 84 RtcpBuilder rtcp_builder_;
71 TransportAudioSender audio_sender_; 85 TransportAudioSender audio_sender_;
72 TransportVideoSender video_sender_; 86 TransportVideoSender video_sender_;
73 87
88 LoggingImpl logging_;
89
90 // This is non-null iff raw events logging is enabled.
91 scoped_ptr<SimpleEventSubscriber> event_subscriber_;
92 base::RepeatingTimer<CastTransportSenderImpl> raw_events_timer_;
93
94 BulkRawEventsCallback raw_events_callback_;
95
74 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl); 96 DISALLOW_COPY_AND_ASSIGN(CastTransportSenderImpl);
75 }; 97 };
76 98
77 } // namespace transport 99 } // namespace transport
78 } // namespace cast 100 } // namespace cast
79 } // namespace media 101 } // namespace media
80 102
81 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_ 103 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698