Chromium Code Reviews| 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_receiver/video_receiver.h" | 5 #include "media/cast/video_receiver/video_receiver.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 DCHECK(false) << "Invalid crypto configuration"; | 117 DCHECK(false) << "Invalid crypto configuration"; |
| 118 } | 118 } |
| 119 | 119 |
| 120 framer_.reset(new Framer(cast_environment->Clock(), | 120 framer_.reset(new Framer(cast_environment->Clock(), |
| 121 incoming_payload_feedback_.get(), | 121 incoming_payload_feedback_.get(), |
| 122 video_config.incoming_ssrc, | 122 video_config.incoming_ssrc, |
| 123 video_config.decoder_faster_than_max_frame_rate, | 123 video_config.decoder_faster_than_max_frame_rate, |
| 124 max_unacked_frames)); | 124 max_unacked_frames)); |
| 125 if (!video_config.use_external_decoder) { | 125 if (!video_config.use_external_decoder) { |
| 126 video_decoder_.reset(new VideoDecoder(video_config, cast_environment)); | 126 video_decoder_.reset(new VideoDecoder(video_config, cast_environment)); |
| 127 cast_environment_->PostTask(CastEnvironment::VIDEO_DECODER, FROM_HERE, | |
|
pwestin
2013/11/21 21:45:38
we can move it all the way into the video_decoder;
mikhal
2013/11/22 22:02:42
Done.
| |
| 128 base::Bind(&VideoReceiver::InitDecoderThread, | |
| 129 weak_factory_.GetWeakPtr())); | |
| 127 } | 130 } |
| 128 | 131 |
| 129 rtcp_.reset( | 132 rtcp_.reset( |
| 130 new Rtcp(cast_environment_, | 133 new Rtcp(cast_environment_, |
| 131 NULL, | 134 NULL, |
| 132 packet_sender, | 135 packet_sender, |
| 133 NULL, | 136 NULL, |
| 134 rtp_video_receiver_statistics_.get(), | 137 rtp_video_receiver_statistics_.get(), |
| 135 video_config.rtcp_mode, | 138 video_config.rtcp_mode, |
| 136 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), | 139 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), |
| 137 video_config.feedback_ssrc, | 140 video_config.feedback_ssrc, |
| 138 video_config.incoming_ssrc, | 141 video_config.incoming_ssrc, |
| 139 video_config.rtcp_c_name)); | 142 video_config.rtcp_c_name)); |
| 140 } | 143 } |
| 141 | 144 |
| 142 VideoReceiver::~VideoReceiver() {} | 145 VideoReceiver::~VideoReceiver() {} |
| 143 | 146 |
| 144 void VideoReceiver::InitializeTimers() { | 147 void VideoReceiver::InitializeTimers() { |
| 145 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 148 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 146 ScheduleNextRtcpReport(); | 149 ScheduleNextRtcpReport(); |
| 147 ScheduleNextCastMessage(); | 150 ScheduleNextCastMessage(); |
| 148 } | 151 } |
| 149 | 152 |
| 153 void VideoReceiver::InitDecoderThread() { | |
| 154 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::VIDEO_DECODER)); | |
| 155 video_decoder_->InitDecoder(); | |
| 156 } | |
| 157 | |
| 150 void VideoReceiver::GetRawVideoFrame( | 158 void VideoReceiver::GetRawVideoFrame( |
| 151 const VideoFrameDecodedCallback& callback) { | 159 const VideoFrameDecodedCallback& callback) { |
| 152 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 160 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 153 GetEncodedVideoFrame(base::Bind(&VideoReceiver::DecodeVideoFrame, | 161 GetEncodedVideoFrame(base::Bind(&VideoReceiver::DecodeVideoFrame, |
| 154 weak_factory_.GetWeakPtr(), | 162 weak_factory_.GetWeakPtr(), |
| 155 callback)); | 163 callback)); |
| 156 } | 164 } |
| 157 | 165 |
| 158 // Called when we have a frame to decode. | 166 // Called when we have a frame to decode. |
| 159 void VideoReceiver::DecodeVideoFrame( | 167 void VideoReceiver::DecodeVideoFrame( |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 } | 465 } |
| 458 | 466 |
| 459 void VideoReceiver::SendNextRtcpReport() { | 467 void VideoReceiver::SendNextRtcpReport() { |
| 460 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 468 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
| 461 rtcp_->SendRtcpFromRtpReceiver(NULL, NULL); | 469 rtcp_->SendRtcpFromRtpReceiver(NULL, NULL); |
| 462 ScheduleNextRtcpReport(); | 470 ScheduleNextRtcpReport(); |
| 463 } | 471 } |
| 464 | 472 |
| 465 } // namespace cast | 473 } // namespace cast |
| 466 } // namespace media | 474 } // namespace media |
| OLD | NEW |