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

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

Powered by Google App Engine
This is Rietveld 408576698