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

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

Issue 174183003: Cast:Transport: Dividing A/V Initialization pipeline (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // This is the main interface for the cast transport sender. The cast sender 5 // This is the main interface for the cast transport sender. The cast sender
6 // handles the cast pipeline from encoded frames (both audio and video), to 6 // handles the cast pipeline from encoded frames (both audio and video), to
7 // encryption, packetization and transport. 7 // encryption, packetization and transport.
8 // All configurations are done at creation.
9 8
10 // Construction of the Cast Sender and the Cast Transport Sender should be done 9 // Construction of the Cast Sender and the Cast Transport Sender should be done
11 // in the following order: 10 // in the following order:
12 // 1. Create CastTransportSender. 11 // 1. Create CastTransportSender.
13 // 2. Create CastSender (accepts CastTransportSender as an input). 12 // 2. Create CastSender (accepts CastTransportSender as an input).
14 // 3. Call CastTransportSender::SetPacketReceiver to ensure that the packets 13 // 3. Call CastTransportSender::SetPacketReceiver to ensure that the packets
15 // received by the CastTransportSender will be sent to the CastSender. 14 // received by the CastTransportSender will be sent to the CastSender.
15 // 4. Initialize audio and/or video.
16 // Steps 3 & 4 can be done interchangeably.
16 17
17 // Destruction: The CastTransportSender is assumed to be valid as long as the 18 // Destruction: The CastTransportSender is assumed to be valid as long as the
18 // CastSender is alive. Therefore the CastSender should be destructed before the 19 // CastSender is alive. Therefore the CastSender should be destructed before the
19 // CastTransportSender. 20 // CastTransportSender.
20 // This also works when the CastSender acts as a receiver for the RTCP packets 21 // This also works when the CastSender acts as a receiver for the RTCP packets
21 // due to the weak pointers in the ReceivedPacket method in cast_sender_impl.cc. 22 // due to the weak pointers in the ReceivedPacket method in cast_sender_impl.cc.
22 23
23 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ 24 #ifndef MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_
24 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ 25 #define MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_
25 26
(...skipping 12 matching lines...) Expand all
38 typedef base::Callback<void(CastTransportStatus status)> 39 typedef base::Callback<void(CastTransportStatus status)>
39 CastTransportStatusCallback; 40 CastTransportStatusCallback;
40 41
41 typedef base::Callback<void(const RtcpSenderInfo& sender_info, 42 typedef base::Callback<void(const RtcpSenderInfo& sender_info,
42 base::TimeTicks time_sent, 43 base::TimeTicks time_sent,
43 uint32 rtp_timestamp)> CastTransportRtpStatistics; 44 uint32 rtp_timestamp)> CastTransportRtpStatistics;
44 45
45 // The application should only trigger this class from the transport thread. 46 // The application should only trigger this class from the transport thread.
46 class CastTransportSender : public base::NonThreadSafe { 47 class CastTransportSender : public base::NonThreadSafe {
47 public: 48 public:
48 static CastTransportSender* CreateCastTransportSender( 49 static scoped_ptr<CastTransportSender> Create(
49 base::TickClock* clock, 50 base::TickClock* clock,
50 const CastTransportConfig& config, 51 const net::IPEndPoint& local_end_point,
52 const net::IPEndPoint& remote_end_point,
51 const CastTransportStatusCallback& status_callback, 53 const CastTransportStatusCallback& status_callback,
52 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner); 54 const scoped_refptr<base::SingleThreadTaskRunner>& transport_task_runner);
53 55
54 virtual ~CastTransportSender() {} 56 virtual ~CastTransportSender() {}
55 57
58 // Initialize audio pipeline. Encoded audio frames cannot be transmitted until
59 // this method is called.
60 virtual void InitializeAudio(const CastTransportAudioConfig& config) = 0;
hubbe 2014/02/21 23:41:23 Can we have these two functions take a CastTranspo
mikhal1 2014/02/24 17:02:50 Sorry, but no. These callbacks are called from the
hubbe 2014/02/25 00:37:04 Ugh, this is soooo messy, but I don't have a reall
61
62 // Initialize video pipeline. Encoded video frames cannot be transmitted until
63 // this method is called.
64 virtual void InitializeVideo(const CastTransportVideoConfig& config) = 0;
65
56 // Sets the Cast packet receiver. Should be called after creation on the 66 // Sets the Cast packet receiver. Should be called after creation on the
57 // Cast sender. Packets won't be received until this function is called. 67 // Cast sender. Packets won't be received until this function is called.
58 virtual void SetPacketReceiver( 68 virtual void SetPacketReceiver(
59 const PacketReceiverCallback& packet_receiver) = 0; 69 const PacketReceiverCallback& packet_receiver) = 0;
60 70
61 // The following two functions handle the encoded media frames (audio and 71 // The following two functions handle the encoded media frames (audio and
62 // video) to be processed. 72 // video) to be processed.
63 // Frames will be encrypted, packetized and transmitted to the network. 73 // Frames will be encrypted, packetized and transmitted to the network.
64 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame, 74 virtual void InsertCodedAudioFrame(const EncodedAudioFrame* audio_frame,
65 const base::TimeTicks& recorded_time) = 0; 75 const base::TimeTicks& recorded_time) = 0;
(...skipping 10 matching lines...) Expand all
76 const std::string& c_name) = 0; 86 const std::string& c_name) = 0;
77 87
78 // Retransmission request. 88 // Retransmission request.
79 virtual void ResendPackets( 89 virtual void ResendPackets(
80 bool is_audio, 90 bool is_audio,
81 const MissingFramesAndPacketsMap& missing_packets) = 0; 91 const MissingFramesAndPacketsMap& missing_packets) = 0;
82 92
83 // Audio/Video RTP statistics. 93 // Audio/Video RTP statistics.
84 // RTP statistics will be returned on a regular interval on the designated 94 // RTP statistics will be returned on a regular interval on the designated
85 // callback. 95 // callback.
96 // Must be called following initialization (InitializeAudio/InitializeVideo).
86 virtual void SubscribeAudioRtpStatsCallback( 97 virtual void SubscribeAudioRtpStatsCallback(
87 const CastTransportRtpStatistics& callback) = 0; 98 const CastTransportRtpStatistics& callback) = 0;
88 99
89 virtual void SubscribeVideoRtpStatsCallback( 100 virtual void SubscribeVideoRtpStatsCallback(
90 const CastTransportRtpStatistics& callback) = 0; 101 const CastTransportRtpStatistics& callback) = 0;
91 }; 102 };
92 103
93 } // namespace transport 104 } // namespace transport
94 } // namespace cast 105 } // namespace cast
95 } // namespace media 106 } // namespace media
96 107
97 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_ 108 #endif // MEDIA_CAST_TRANSPORT_CAST_TRANSPORT_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698