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

Side by Side Diff: media/cast/audio_receiver/audio_receiver.h

Issue 288103002: [Cast] EncodedAudioFrame+EncodedVideoFrame+reference_time --> EncodedFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 #ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ 5 #ifndef MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_
6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ 6 #define MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // the configuration that was passed to the ctor. 69 // the configuration that was passed to the ctor.
70 // 70 //
71 // The given |callback| is guaranteed to be run at some point in the future, 71 // The given |callback| is guaranteed to be run at some point in the future,
72 // even if to respond with NULL at shutdown time. 72 // even if to respond with NULL at shutdown time.
73 void GetRawAudioFrame(const AudioFrameDecodedCallback& callback); 73 void GetRawAudioFrame(const AudioFrameDecodedCallback& callback);
74 74
75 // Request an encoded audio frame. 75 // Request an encoded audio frame.
76 // 76 //
77 // The given |callback| is guaranteed to be run at some point in the future, 77 // The given |callback| is guaranteed to be run at some point in the future,
78 // even if to respond with NULL at shutdown time. 78 // even if to respond with NULL at shutdown time.
79 void GetEncodedAudioFrame(const AudioFrameEncodedCallback& callback); 79 void GetEncodedAudioFrame(const FrameEncodedCallback& callback);
80 80
81 // Deliver another packet, possibly a duplicate, and possibly out-of-order. 81 // Deliver another packet, possibly a duplicate, and possibly out-of-order.
82 void IncomingPacket(scoped_ptr<Packet> packet); 82 void IncomingPacket(scoped_ptr<Packet> packet);
83 83
84 // Update target audio delay used to compute the playout time. Rtcp 84 // Update target audio delay used to compute the playout time. Rtcp
85 // will also be updated (will be included in all outgoing reports). 85 // will also be updated (will be included in all outgoing reports).
86 void SetTargetDelay(base::TimeDelta target_delay); 86 void SetTargetDelay(base::TimeDelta target_delay);
87 87
88 protected: 88 protected:
89 friend class AudioReceiverTest; // Invokes OnReceivedPayloadData(). 89 friend class AudioReceiverTest; // Invokes OnReceivedPayloadData().
90 90
91 virtual void OnReceivedPayloadData(const uint8* payload_data, 91 virtual void OnReceivedPayloadData(const uint8* payload_data,
92 size_t payload_size, 92 size_t payload_size,
93 const RtpCastHeader& rtp_header) OVERRIDE; 93 const RtpCastHeader& rtp_header) OVERRIDE;
94 94
95 // RtpPayloadFeedback implementation. 95 // RtpPayloadFeedback implementation.
96 virtual void CastFeedback(const RtcpCastMessage& cast_message) OVERRIDE; 96 virtual void CastFeedback(const RtcpCastMessage& cast_message) OVERRIDE;
97 97
98 private: 98 private:
99 // Processes ready-to-consume packets from |framer_|, decrypting each packet's 99 // Processes ready-to-consume packets from |framer_|, decrypting each packet's
100 // payload data, and then running the enqueued callbacks in order (one for 100 // payload data, and then running the enqueued callbacks in order (one for
101 // each packet). This method may post a delayed task to re-invoke itself in 101 // each packet). This method may post a delayed task to re-invoke itself in
102 // the future to wait for missing/incomplete frames. 102 // the future to wait for missing/incomplete frames.
103 void EmitAvailableEncodedFrames(); 103 void EmitAvailableEncodedFrames();
104 104
105 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes 105 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes
106 // EmitAvailableEncodedFrames(). 106 // EmitAvailableEncodedFrames().
107 void EmitAvailableEncodedFramesAfterWaiting(); 107 void EmitAvailableEncodedFramesAfterWaiting();
108 108
109 // Feeds an EncodedAudioFrame into |audio_decoder_|. GetRawAudioFrame() uses 109 // Feeds an EncodedFrame into |audio_decoder_|. GetRawAudioFrame() uses this
110 // this as a callback for GetEncodedAudioFrame(). 110 // as a callback for GetEncodedAudioFrame().
111 void DecodeEncodedAudioFrame( 111 void DecodeEncodedAudioFrame(
112 const AudioFrameDecodedCallback& callback, 112 const AudioFrameDecodedCallback& callback,
113 scoped_ptr<transport::EncodedAudioFrame> encoded_frame, 113 scoped_ptr<transport::EncodedFrame> encoded_frame);
114 const base::TimeTicks& playout_time);
115 114
116 // Return the playout time based on the current time and rtp timestamp. 115 // Return the playout time based on the current time and rtp timestamp.
117 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); 116 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp);
118 117
119 void InitializeTimers(); 118 void InitializeTimers();
120 119
121 // Schedule the next RTCP report. 120 // Schedule the next RTCP report.
122 void ScheduleNextRtcpReport(); 121 void ScheduleNextRtcpReport();
123 122
124 // Actually send the next RTCP report. 123 // Actually send the next RTCP report.
(...skipping 30 matching lines...) Expand all
155 base::TimeDelta target_delay_delta_; 154 base::TimeDelta target_delay_delta_;
156 Framer framer_; 155 Framer framer_;
157 scoped_ptr<AudioDecoder> audio_decoder_; 156 scoped_ptr<AudioDecoder> audio_decoder_;
158 Rtcp rtcp_; 157 Rtcp rtcp_;
159 base::TimeDelta time_offset_; 158 base::TimeDelta time_offset_;
160 base::TimeTicks time_first_incoming_packet_; 159 base::TimeTicks time_first_incoming_packet_;
161 uint32 first_incoming_rtp_timestamp_; 160 uint32 first_incoming_rtp_timestamp_;
162 transport::TransportEncryptionHandler decryptor_; 161 transport::TransportEncryptionHandler decryptor_;
163 162
164 // Outstanding callbacks to run to deliver on client requests for frames. 163 // Outstanding callbacks to run to deliver on client requests for frames.
165 std::list<AudioFrameEncodedCallback> frame_request_queue_; 164 std::list<FrameEncodedCallback> frame_request_queue_;
166 165
167 // True while there's an outstanding task to re-invoke 166 // True while there's an outstanding task to re-invoke
168 // EmitAvailableEncodedFrames(). 167 // EmitAvailableEncodedFrames().
169 bool is_waiting_for_consecutive_frame_; 168 bool is_waiting_for_consecutive_frame_;
170 169
171 // This mapping allows us to log AUDIO_ACK_SENT as a frame event. In addition 170 // This mapping allows us to log AUDIO_ACK_SENT as a frame event. In addition
172 // it allows the event to be transmitted via RTCP. 171 // it allows the event to be transmitted via RTCP.
173 RtpTimestamp frame_id_to_rtp_timestamp_[256]; 172 RtpTimestamp frame_id_to_rtp_timestamp_[256];
174 173
175 // NOTE: Weak pointers must be invalidated before all other member variables. 174 // NOTE: Weak pointers must be invalidated before all other member variables.
176 base::WeakPtrFactory<AudioReceiver> weak_factory_; 175 base::WeakPtrFactory<AudioReceiver> weak_factory_;
177 176
178 DISALLOW_COPY_AND_ASSIGN(AudioReceiver); 177 DISALLOW_COPY_AND_ASSIGN(AudioReceiver);
179 }; 178 };
180 179
181 } // namespace cast 180 } // namespace cast
182 } // namespace media 181 } // namespace media
183 182
184 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_ 183 #endif // MEDIA_CAST_AUDIO_RECEIVER_AUDIO_RECEIVER_H_
OLDNEW
« no previous file with comments | « media/cast/audio_receiver/audio_decoder_unittest.cc ('k') | media/cast/audio_receiver/audio_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698