OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Insert a RTP packet to the video receiver. | 54 // Insert a RTP packet to the video receiver. |
55 void IncomingPacket(const uint8* packet, size_t length, | 55 void IncomingPacket(const uint8* packet, size_t length, |
56 const base::Closure callback); | 56 const base::Closure callback); |
57 | 57 |
58 protected: | 58 protected: |
59 void IncomingParsedRtpPacket(const uint8* payload_data, | 59 void IncomingParsedRtpPacket(const uint8* payload_data, |
60 size_t payload_size, | 60 size_t payload_size, |
61 const RtpCastHeader& rtp_header); | 61 const RtpCastHeader& rtp_header); |
62 | 62 |
63 void DecodeVideoFrameThread( | 63 void DecodeVideoFrameThread( |
64 scoped_ptr<EncodedVideoFrame> encoded_frame, | 64 scoped_ptr<transport::EncodedVideoFrame> encoded_frame, |
65 const base::TimeTicks render_time, | 65 const base::TimeTicks render_time, |
66 const VideoFrameDecodedCallback& frame_decoded_callback); | 66 const VideoFrameDecodedCallback& frame_decoded_callback); |
67 | 67 |
68 private: | 68 private: |
69 friend class LocalRtpVideoData; | 69 friend class LocalRtpVideoData; |
70 friend class LocalRtpVideoFeedback; | 70 friend class LocalRtpVideoFeedback; |
71 | 71 |
72 void CastFeedback(const RtcpCastMessage& cast_message); | 72 void CastFeedback(const RtcpCastMessage& cast_message); |
73 | 73 |
74 void DecodeVideoFrame(const VideoFrameDecodedCallback& callback, | 74 void DecodeVideoFrame(const VideoFrameDecodedCallback& callback, |
75 scoped_ptr<EncodedVideoFrame> encoded_frame, | 75 scoped_ptr<transport::EncodedVideoFrame> encoded_frame, |
76 const base::TimeTicks& render_time); | 76 const base::TimeTicks& render_time); |
77 | 77 |
78 bool DecryptVideoFrame(scoped_ptr<EncodedVideoFrame>* video_frame); | 78 bool DecryptVideoFrame(scoped_ptr<transport::EncodedVideoFrame>* video_frame); |
79 | 79 |
80 bool PullEncodedVideoFrame(uint32 rtp_timestamp, | 80 bool PullEncodedVideoFrame( |
81 bool next_frame, | 81 uint32 rtp_timestamp, |
82 scoped_ptr<EncodedVideoFrame>* encoded_frame, | 82 bool next_frame, |
83 base::TimeTicks* render_time); | 83 scoped_ptr<transport::EncodedVideoFrame>* encoded_frame, |
| 84 base::TimeTicks* render_time); |
84 | 85 |
85 void PlayoutTimeout(); | 86 void PlayoutTimeout(); |
86 | 87 |
87 // Returns Render time based on current time and the rtp timestamp. | 88 // Returns Render time based on current time and the rtp timestamp. |
88 base::TimeTicks GetRenderTime(base::TimeTicks now, uint32 rtp_timestamp); | 89 base::TimeTicks GetRenderTime(base::TimeTicks now, uint32 rtp_timestamp); |
89 | 90 |
90 void InitializeTimers(); | 91 void InitializeTimers(); |
91 | 92 |
92 // Schedule timing for the next cast message. | 93 // Schedule timing for the next cast message. |
93 void ScheduleNextCastMessage(); | 94 void ScheduleNextCastMessage(); |
94 | 95 |
95 // Schedule timing for the next RTCP report. | 96 // Schedule timing for the next RTCP report. |
96 void ScheduleNextRtcpReport(); | 97 void ScheduleNextRtcpReport(); |
97 | 98 |
98 // Actually send the next cast message. | 99 // Actually send the next cast message. |
99 void SendNextCastMessage(); | 100 void SendNextCastMessage(); |
100 | 101 |
101 // Actually send the next RTCP report. | 102 // Actually send the next RTCP report. |
102 void SendNextRtcpReport(); | 103 void SendNextRtcpReport(); |
103 | 104 |
104 scoped_ptr<VideoDecoder> video_decoder_; | 105 scoped_ptr<VideoDecoder> video_decoder_; |
105 scoped_refptr<CastEnvironment> cast_environment_; | 106 scoped_refptr<CastEnvironment> cast_environment_; |
106 scoped_ptr<Framer> framer_; | 107 scoped_ptr<Framer> framer_; |
107 const VideoCodec codec_; | 108 const transport::VideoCodec codec_; |
108 base::TimeDelta target_delay_delta_; | 109 base::TimeDelta target_delay_delta_; |
109 base::TimeDelta frame_delay_; | 110 base::TimeDelta frame_delay_; |
110 scoped_ptr<LocalRtpVideoData> incoming_payload_callback_; | 111 scoped_ptr<LocalRtpVideoData> incoming_payload_callback_; |
111 scoped_ptr<LocalRtpVideoFeedback> incoming_payload_feedback_; | 112 scoped_ptr<LocalRtpVideoFeedback> incoming_payload_feedback_; |
112 RtpReceiver rtp_receiver_; | 113 RtpReceiver rtp_receiver_; |
113 scoped_ptr<Rtcp> rtcp_; | 114 scoped_ptr<Rtcp> rtcp_; |
114 scoped_ptr<RtpReceiverStatistics> rtp_video_receiver_statistics_; | 115 scoped_ptr<RtpReceiverStatistics> rtp_video_receiver_statistics_; |
115 base::TimeTicks time_last_sent_cast_message_; | 116 base::TimeTicks time_last_sent_cast_message_; |
116 base::TimeDelta time_offset_; // Sender-receiver offset estimation. | 117 base::TimeDelta time_offset_; // Sender-receiver offset estimation. |
117 scoped_ptr<crypto::Encryptor> decryptor_; | 118 scoped_ptr<crypto::Encryptor> decryptor_; |
118 scoped_ptr<crypto::SymmetricKey> decryption_key_; | 119 scoped_ptr<crypto::SymmetricKey> decryption_key_; |
119 std::string iv_mask_; | 120 std::string iv_mask_; |
120 std::list<VideoFrameEncodedCallback> queued_encoded_callbacks_; | 121 std::list<VideoFrameEncodedCallback> queued_encoded_callbacks_; |
121 bool time_incoming_packet_updated_; | 122 bool time_incoming_packet_updated_; |
122 base::TimeTicks time_incoming_packet_; | 123 base::TimeTicks time_incoming_packet_; |
123 uint32 incoming_rtp_timestamp_; | 124 uint32 incoming_rtp_timestamp_; |
124 base::TimeTicks last_render_time_; | 125 base::TimeTicks last_render_time_; |
125 | 126 |
126 base::WeakPtrFactory<VideoReceiver> weak_factory_; | 127 base::WeakPtrFactory<VideoReceiver> weak_factory_; |
127 | 128 |
128 DISALLOW_COPY_AND_ASSIGN(VideoReceiver); | 129 DISALLOW_COPY_AND_ASSIGN(VideoReceiver); |
129 }; | 130 }; |
130 | 131 |
131 } // namespace cast | 132 } // namespace cast |
132 } // namespace media | 133 } // namespace media |
133 | 134 |
134 #endif // MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ | 135 #endif // MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ |
OLD | NEW |