| 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<transport::EncodedVideoFrame> encoded_frame, | 64 scoped_ptr<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<transport::EncodedVideoFrame> encoded_frame, | 75 scoped_ptr<EncodedVideoFrame> encoded_frame, |
| 76 const base::TimeTicks& render_time); | 76 const base::TimeTicks& render_time); |
| 77 | 77 |
| 78 bool DecryptVideoFrame(scoped_ptr<transport::EncodedVideoFrame>* video_frame); | 78 bool DecryptVideoFrame(scoped_ptr<EncodedVideoFrame>* video_frame); |
| 79 | 79 |
| 80 bool PullEncodedVideoFrame( | 80 bool PullEncodedVideoFrame(uint32 rtp_timestamp, |
| 81 uint32 rtp_timestamp, | 81 bool next_frame, |
| 82 bool next_frame, | 82 scoped_ptr<EncodedVideoFrame>* encoded_frame, |
| 83 scoped_ptr<transport::EncodedVideoFrame>* encoded_frame, | 83 base::TimeTicks* render_time); |
| 84 base::TimeTicks* render_time); | |
| 85 | 84 |
| 86 void PlayoutTimeout(); | 85 void PlayoutTimeout(); |
| 87 | 86 |
| 88 // Returns Render time based on current time and the rtp timestamp. | 87 // Returns Render time based on current time and the rtp timestamp. |
| 89 base::TimeTicks GetRenderTime(base::TimeTicks now, uint32 rtp_timestamp); | 88 base::TimeTicks GetRenderTime(base::TimeTicks now, uint32 rtp_timestamp); |
| 90 | 89 |
| 91 void InitializeTimers(); | 90 void InitializeTimers(); |
| 92 | 91 |
| 93 // Schedule timing for the next cast message. | 92 // Schedule timing for the next cast message. |
| 94 void ScheduleNextCastMessage(); | 93 void ScheduleNextCastMessage(); |
| 95 | 94 |
| 96 // Schedule timing for the next RTCP report. | 95 // Schedule timing for the next RTCP report. |
| 97 void ScheduleNextRtcpReport(); | 96 void ScheduleNextRtcpReport(); |
| 98 | 97 |
| 99 // Actually send the next cast message. | 98 // Actually send the next cast message. |
| 100 void SendNextCastMessage(); | 99 void SendNextCastMessage(); |
| 101 | 100 |
| 102 // Actually send the next RTCP report. | 101 // Actually send the next RTCP report. |
| 103 void SendNextRtcpReport(); | 102 void SendNextRtcpReport(); |
| 104 | 103 |
| 105 scoped_ptr<VideoDecoder> video_decoder_; | 104 scoped_ptr<VideoDecoder> video_decoder_; |
| 106 scoped_refptr<CastEnvironment> cast_environment_; | 105 scoped_refptr<CastEnvironment> cast_environment_; |
| 107 scoped_ptr<Framer> framer_; | 106 scoped_ptr<Framer> framer_; |
| 108 const transport::VideoCodec codec_; | 107 const VideoCodec codec_; |
| 109 base::TimeDelta target_delay_delta_; | 108 base::TimeDelta target_delay_delta_; |
| 110 base::TimeDelta frame_delay_; | 109 base::TimeDelta frame_delay_; |
| 111 scoped_ptr<LocalRtpVideoData> incoming_payload_callback_; | 110 scoped_ptr<LocalRtpVideoData> incoming_payload_callback_; |
| 112 scoped_ptr<LocalRtpVideoFeedback> incoming_payload_feedback_; | 111 scoped_ptr<LocalRtpVideoFeedback> incoming_payload_feedback_; |
| 113 RtpReceiver rtp_receiver_; | 112 RtpReceiver rtp_receiver_; |
| 114 scoped_ptr<Rtcp> rtcp_; | 113 scoped_ptr<Rtcp> rtcp_; |
| 115 scoped_ptr<RtpReceiverStatistics> rtp_video_receiver_statistics_; | 114 scoped_ptr<RtpReceiverStatistics> rtp_video_receiver_statistics_; |
| 116 base::TimeTicks time_last_sent_cast_message_; | 115 base::TimeTicks time_last_sent_cast_message_; |
| 117 base::TimeDelta time_offset_; // Sender-receiver offset estimation. | 116 base::TimeDelta time_offset_; // Sender-receiver offset estimation. |
| 118 scoped_ptr<crypto::Encryptor> decryptor_; | 117 scoped_ptr<crypto::Encryptor> decryptor_; |
| 119 scoped_ptr<crypto::SymmetricKey> decryption_key_; | 118 scoped_ptr<crypto::SymmetricKey> decryption_key_; |
| 120 std::string iv_mask_; | 119 std::string iv_mask_; |
| 121 std::list<VideoFrameEncodedCallback> queued_encoded_callbacks_; | 120 std::list<VideoFrameEncodedCallback> queued_encoded_callbacks_; |
| 122 bool time_incoming_packet_updated_; | 121 bool time_incoming_packet_updated_; |
| 123 base::TimeTicks time_incoming_packet_; | 122 base::TimeTicks time_incoming_packet_; |
| 124 uint32 incoming_rtp_timestamp_; | 123 uint32 incoming_rtp_timestamp_; |
| 125 base::TimeTicks last_render_time_; | 124 base::TimeTicks last_render_time_; |
| 126 | 125 |
| 127 base::WeakPtrFactory<VideoReceiver> weak_factory_; | 126 base::WeakPtrFactory<VideoReceiver> weak_factory_; |
| 128 | 127 |
| 129 DISALLOW_COPY_AND_ASSIGN(VideoReceiver); | 128 DISALLOW_COPY_AND_ASSIGN(VideoReceiver); |
| 130 }; | 129 }; |
| 131 | 130 |
| 132 } // namespace cast | 131 } // namespace cast |
| 133 } // namespace media | 132 } // namespace media |
| 134 | 133 |
| 135 #endif // MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ | 134 #endif // MEDIA_CAST_VIDEO_RECEIVER_VIDEO_RECEIVER_H_ |
| OLD | NEW |