| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/receiver/frame_receiver.h" | 5 #include "media/cast/receiver/frame_receiver.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/big_endian.h" | 9 #include "base/big_endian.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 : cast_environment_(cast_environment), | 27 : cast_environment_(cast_environment), |
| 28 transport_(transport), | 28 transport_(transport), |
| 29 packet_parser_(config.incoming_ssrc, config.rtp_payload_type), | 29 packet_parser_(config.incoming_ssrc, config.rtp_payload_type), |
| 30 stats_(cast_environment->Clock()), | 30 stats_(cast_environment->Clock()), |
| 31 event_media_type_(event_media_type), | 31 event_media_type_(event_media_type), |
| 32 event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type), | 32 event_subscriber_(kReceiverRtcpEventHistorySize, event_media_type), |
| 33 rtp_timebase_(config.frequency), | 33 rtp_timebase_(config.frequency), |
| 34 target_playout_delay_( | 34 target_playout_delay_( |
| 35 base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)), | 35 base::TimeDelta::FromMilliseconds(config.rtp_max_delay_ms)), |
| 36 expected_frame_duration_( | 36 expected_frame_duration_( |
| 37 base::TimeDelta::FromSeconds(1) / config.max_frame_rate), | 37 base::TimeDelta::FromSeconds(1) / config.target_frame_rate), |
| 38 reports_are_scheduled_(false), | 38 reports_are_scheduled_(false), |
| 39 framer_(cast_environment->Clock(), | 39 framer_(cast_environment->Clock(), |
| 40 this, | 40 this, |
| 41 config.incoming_ssrc, | 41 config.incoming_ssrc, |
| 42 true, | 42 true, |
| 43 config.rtp_max_delay_ms * config.max_frame_rate / 1000), | 43 config.rtp_max_delay_ms * config.target_frame_rate / 1000), |
| 44 rtcp_(RtcpCastMessageCallback(), | 44 rtcp_(RtcpCastMessageCallback(), |
| 45 RtcpRttCallback(), | 45 RtcpRttCallback(), |
| 46 RtcpLogMessageCallback(), | 46 RtcpLogMessageCallback(), |
| 47 cast_environment_->Clock(), | 47 cast_environment_->Clock(), |
| 48 NULL, | 48 NULL, |
| 49 config.feedback_ssrc, | 49 config.feedback_ssrc, |
| 50 config.incoming_ssrc), | 50 config.incoming_ssrc), |
| 51 is_waiting_for_consecutive_frame_(false), | 51 is_waiting_for_consecutive_frame_(false), |
| 52 lip_sync_drift_(ClockDriftSmoother::GetDefaultTimeConstant()), | 52 lip_sync_drift_(ClockDriftSmoother::GetDefaultTimeConstant()), |
| 53 rtcp_interval_(base::TimeDelta::FromMilliseconds(config.rtcp_interval)), | 53 rtcp_interval_(base::TimeDelta::FromMilliseconds(config.rtcp_interval)), |
| 54 weak_factory_(this) { | 54 weak_factory_(this) { |
| 55 transport_->AddValidSsrc(config.incoming_ssrc); | 55 transport_->AddValidSsrc(config.incoming_ssrc); |
| 56 DCHECK_GT(config.rtp_max_delay_ms, 0); | 56 DCHECK_GT(config.rtp_max_delay_ms, 0); |
| 57 DCHECK_GT(config.max_frame_rate, 0); | 57 DCHECK_GT(config.target_frame_rate, 0); |
| 58 decryptor_.Initialize(config.aes_key, config.aes_iv_mask); | 58 decryptor_.Initialize(config.aes_key, config.aes_iv_mask); |
| 59 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); | 59 cast_environment_->Logging()->AddRawEventSubscriber(&event_subscriber_); |
| 60 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); | 60 memset(frame_id_to_rtp_timestamp_, 0, sizeof(frame_id_to_rtp_timestamp_)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 FrameReceiver::~FrameReceiver() { | 63 FrameReceiver::~FrameReceiver() { |
| 64 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 64 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 65 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); | 65 cast_environment_->Logging()->RemoveRawEventSubscriber(&event_subscriber_); |
| 66 } | 66 } |
| 67 | 67 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 rtcp_.ConvertToNTPAndSave(now), | 341 rtcp_.ConvertToNTPAndSave(now), |
| 342 NULL, | 342 NULL, |
| 343 base::TimeDelta(), | 343 base::TimeDelta(), |
| 344 NULL, | 344 NULL, |
| 345 &stats); | 345 &stats); |
| 346 ScheduleNextRtcpReport(); | 346 ScheduleNextRtcpReport(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace cast | 349 } // namespace cast |
| 350 } // namespace media | 350 } // namespace media |
| OLD | NEW |