| 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 #include "media/cast/video_sender/video_sender.h" | 5 #include "media/cast/video_sender/video_sender.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 base::TimeTicks time_sent_; | 88 base::TimeTicks time_sent_; |
| 89 uint32 rtp_timestamp_; | 89 uint32 rtp_timestamp_; |
| 90 | 90 |
| 91 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalRtpVideoSenderStatistics); | 91 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalRtpVideoSenderStatistics); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 VideoSender::VideoSender( | 94 VideoSender::VideoSender( |
| 95 scoped_refptr<CastEnvironment> cast_environment, | 95 scoped_refptr<CastEnvironment> cast_environment, |
| 96 const VideoSenderConfig& video_config, | 96 const VideoSenderConfig& video_config, |
| 97 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, | 97 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, |
| 98 const CastInitializationCallback& initialization_status, | 98 const CastInitializationCallback& cast_initialization_cb, |
| 99 transport::CastTransportSender* const transport_sender) | 99 transport::CastTransportSender* const transport_sender) |
| 100 : rtp_max_delay_(base::TimeDelta::FromMilliseconds( | 100 : rtp_max_delay_(base::TimeDelta::FromMilliseconds( |
| 101 video_config.rtp_config.max_delay_ms)), | 101 video_config.rtp_config.max_delay_ms)), |
| 102 max_frame_rate_(video_config.max_frame_rate), | 102 max_frame_rate_(video_config.max_frame_rate), |
| 103 cast_environment_(cast_environment), | 103 cast_environment_(cast_environment), |
| 104 transport_sender_(transport_sender), | 104 transport_sender_(transport_sender), |
| 105 event_subscriber_(kMaxEventSubscriberEntries), | 105 event_subscriber_(kMaxEventSubscriberEntries), |
| 106 rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)), | 106 rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)), |
| 107 last_acked_frame_id_(-1), | 107 last_acked_frame_id_(-1), |
| 108 last_sent_frame_id_(-1), | 108 last_sent_frame_id_(-1), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 NULL, // paced sender. | 142 NULL, // paced sender. |
| 143 rtp_video_sender_statistics_.get(), | 143 rtp_video_sender_statistics_.get(), |
| 144 NULL, | 144 NULL, |
| 145 video_config.rtcp_mode, | 145 video_config.rtcp_mode, |
| 146 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), | 146 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), |
| 147 video_config.sender_ssrc, | 147 video_config.sender_ssrc, |
| 148 video_config.incoming_feedback_ssrc, | 148 video_config.incoming_feedback_ssrc, |
| 149 video_config.rtcp_c_name)); | 149 video_config.rtcp_c_name)); |
| 150 rtcp_->SetCastReceiverEventHistorySize(kReceiverRtcpEventHistorySize); | 150 rtcp_->SetCastReceiverEventHistorySize(kReceiverRtcpEventHistorySize); |
| 151 | 151 |
| 152 // TODO(pwestin): pass cast_initialization to |video_encoder_| | 152 // TODO(pwestin): pass cast_initialization_cb to |video_encoder_| |
| 153 // and remove this call. | 153 // and remove this call. |
| 154 cast_environment_->PostTask( | 154 cast_environment_->PostTask( |
| 155 CastEnvironment::MAIN, | 155 CastEnvironment::MAIN, |
| 156 FROM_HERE, | 156 FROM_HERE, |
| 157 base::Bind(initialization_status, STATUS_INITIALIZED)); | 157 base::Bind(cast_initialization_cb, STATUS_VIDEO_INITIALIZED)); |
| 158 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); | 158 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); |
| 159 | 159 |
| 160 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); | 160 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); |
| 161 } | 161 } |
| 162 | 162 |
| 163 VideoSender::~VideoSender() { | 163 VideoSender::~VideoSender() { |
| 164 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); | 164 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); |
| 165 } | 165 } |
| 166 | 166 |
| 167 void VideoSender::InitializeTimers() { | 167 void VideoSender::InitializeTimers() { |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 495 |
| 496 void VideoSender::ResendPacketsOnTransportThread( | 496 void VideoSender::ResendPacketsOnTransportThread( |
| 497 const transport::MissingFramesAndPacketsMap& missing_packets) { | 497 const transport::MissingFramesAndPacketsMap& missing_packets) { |
| 498 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::TRANSPORT)); | 498 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::TRANSPORT)); |
| 499 last_send_time_ = cast_environment_->Clock()->NowTicks(); | 499 last_send_time_ = cast_environment_->Clock()->NowTicks(); |
| 500 transport_sender_->ResendPackets(false, missing_packets); | 500 transport_sender_->ResendPackets(false, missing_packets); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace cast | 503 } // namespace cast |
| 504 } // namespace media | 504 } // namespace media |
| OLD | NEW |