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

Side by Side Diff: media/cast/video_receiver/video_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_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ 5 #ifndef MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_
6 #define MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ 6 #define MEDIA_CAST_VIDEO_RECEIVER_VIDEO_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/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Request a decoded video frame. 69 // Request a decoded video frame.
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 GetRawVideoFrame(const VideoFrameDecodedCallback& callback); 73 void GetRawVideoFrame(const VideoFrameDecodedCallback& callback);
74 74
75 // Request an encoded video frame. 75 // Request an encoded video 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 GetEncodedVideoFrame(const VideoFrameEncodedCallback& callback); 79 void GetEncodedVideoFrame(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 protected: 84 protected:
85 friend class VideoReceiverTest; // Invoked OnReceivedPayloadData(). 85 friend class VideoReceiverTest; // Invoked OnReceivedPayloadData().
86 86
87 virtual void OnReceivedPayloadData(const uint8* payload_data, 87 virtual void OnReceivedPayloadData(const uint8* payload_data,
88 size_t payload_size, 88 size_t payload_size,
89 const RtpCastHeader& rtp_header) OVERRIDE; 89 const RtpCastHeader& rtp_header) OVERRIDE;
90 90
91 // RtpPayloadFeedback implementation. 91 // RtpPayloadFeedback implementation.
92 virtual void CastFeedback(const RtcpCastMessage& cast_message) OVERRIDE; 92 virtual void CastFeedback(const RtcpCastMessage& cast_message) OVERRIDE;
93 93
94 private: 94 private:
95 // Processes ready-to-consume packets from |framer_|, decrypting each packet's 95 // Processes ready-to-consume packets from |framer_|, decrypting each packet's
96 // payload data, and then running the enqueued callbacks in order (one for 96 // payload data, and then running the enqueued callbacks in order (one for
97 // each packet). This method may post a delayed task to re-invoke itself in 97 // each packet). This method may post a delayed task to re-invoke itself in
98 // the future to wait for missing/incomplete frames. 98 // the future to wait for missing/incomplete frames.
99 void EmitAvailableEncodedFrames(); 99 void EmitAvailableEncodedFrames();
100 100
101 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes 101 // Clears the |is_waiting_for_consecutive_frame_| flag and invokes
102 // EmitAvailableEncodedFrames(). 102 // EmitAvailableEncodedFrames().
103 void EmitAvailableEncodedFramesAfterWaiting(); 103 void EmitAvailableEncodedFramesAfterWaiting();
104 104
105 // Feeds an EncodedVideoFrame into |video_decoder_|. GetRawVideoFrame() uses 105 // Feeds an EncodedFrame into |video_decoder_|. GetRawVideoFrame() uses this
106 // this as a callback for GetEncodedVideoFrame(). 106 // as a callback for GetEncodedVideoFrame().
107 void DecodeEncodedVideoFrame( 107 void DecodeEncodedVideoFrame(
108 const VideoFrameDecodedCallback& callback, 108 const VideoFrameDecodedCallback& callback,
109 scoped_ptr<transport::EncodedVideoFrame> encoded_frame, 109 scoped_ptr<transport::EncodedFrame> encoded_frame);
110 const base::TimeTicks& playout_time);
111 110
112 // Return the playout time based on the current time and rtp timestamp. 111 // Return the playout time based on the current time and rtp timestamp.
113 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp); 112 base::TimeTicks GetPlayoutTime(base::TimeTicks now, uint32 rtp_timestamp);
114 113
115 void InitializeTimers(); 114 void InitializeTimers();
116 115
117 // Schedule timing for the next cast message. 116 // Schedule timing for the next cast message.
118 void ScheduleNextCastMessage(); 117 void ScheduleNextCastMessage();
119 118
120 // Schedule timing for the next RTCP report. 119 // Schedule timing for the next RTCP report.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 scoped_ptr<VideoDecoder> video_decoder_; 152 scoped_ptr<VideoDecoder> video_decoder_;
154 Rtcp rtcp_; 153 Rtcp rtcp_;
155 base::TimeDelta time_offset_; // Sender-receiver offset estimation. 154 base::TimeDelta time_offset_; // Sender-receiver offset estimation.
156 int time_offset_counter_; 155 int time_offset_counter_;
157 bool time_incoming_packet_updated_; 156 bool time_incoming_packet_updated_;
158 base::TimeTicks time_incoming_packet_; 157 base::TimeTicks time_incoming_packet_;
159 uint32 incoming_rtp_timestamp_; 158 uint32 incoming_rtp_timestamp_;
160 transport::TransportEncryptionHandler decryptor_; 159 transport::TransportEncryptionHandler decryptor_;
161 160
162 // Outstanding callbacks to run to deliver on client requests for frames. 161 // Outstanding callbacks to run to deliver on client requests for frames.
163 std::list<VideoFrameEncodedCallback> frame_request_queue_; 162 std::list<FrameEncodedCallback> frame_request_queue_;
164 163
165 // True while there's an outstanding task to re-invoke 164 // True while there's an outstanding task to re-invoke
166 // EmitAvailableEncodedFrames(). 165 // EmitAvailableEncodedFrames().
167 bool is_waiting_for_consecutive_frame_; 166 bool is_waiting_for_consecutive_frame_;
168 167
169 // This mapping allows us to log FRAME_ACK_SENT as a frame event. In addition 168 // This mapping allows us to log FRAME_ACK_SENT as a frame event. In addition
170 // it allows the event to be transmitted via RTCP. 169 // it allows the event to be transmitted via RTCP.
171 RtpTimestamp frame_id_to_rtp_timestamp_[256]; 170 RtpTimestamp frame_id_to_rtp_timestamp_[256];
172 171
173 // NOTE: Weak pointers must be invalidated before all other member variables. 172 // NOTE: Weak pointers must be invalidated before all other member variables.
174 base::WeakPtrFactory<VideoReceiver> weak_factory_; 173 base::WeakPtrFactory<VideoReceiver> weak_factory_;
175 174
176 DISALLOW_COPY_AND_ASSIGN(VideoReceiver); 175 DISALLOW_COPY_AND_ASSIGN(VideoReceiver);
177 }; 176 };
178 177
179 } // namespace cast 178 } // namespace cast
180 } // namespace media 179 } // namespace media
181 180
182 #endif // MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ 181 #endif // MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_
OLDNEW
« no previous file with comments | « media/cast/video_receiver/video_decoder_unittest.cc ('k') | media/cast/video_receiver/video_receiver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698