Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Side by Side Diff: media/cast/video_receiver/video_receiver.cc

Issue 80383006: Cast: Forcing codec initialization on a designated thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 InitDecoder();
127 } 128 }
128 129
129 rtcp_.reset( 130 rtcp_.reset(
130 new Rtcp(cast_environment_, 131 new Rtcp(cast_environment_,
131 NULL, 132 NULL,
132 packet_sender, 133 packet_sender,
133 NULL, 134 NULL,
134 rtp_video_receiver_statistics_.get(), 135 rtp_video_receiver_statistics_.get(),
135 video_config.rtcp_mode, 136 video_config.rtcp_mode,
136 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval), 137 base::TimeDelta::FromMilliseconds(video_config.rtcp_interval),
137 video_config.feedback_ssrc, 138 video_config.feedback_ssrc,
138 video_config.incoming_ssrc, 139 video_config.incoming_ssrc,
139 video_config.rtcp_c_name)); 140 video_config.rtcp_c_name));
140 } 141 }
141 142
142 VideoReceiver::~VideoReceiver() {} 143 VideoReceiver::~VideoReceiver() {}
143 144
144 void VideoReceiver::InitializeTimers() { 145 void VideoReceiver::InitializeTimers() {
145 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 146 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
146 ScheduleNextRtcpReport(); 147 ScheduleNextRtcpReport();
147 ScheduleNextCastMessage(); 148 ScheduleNextCastMessage();
148 } 149 }
149 150
151 void VideoReceiver::InitDecoder() {
pwestin 2013/11/21 19:10:42 instead of having this code here; why not post the
mikhal 2013/11/21 19:27:00 Had th same thought, but wasn't sure what's better
152 cast_environment_->PostTask(CastEnvironment::VIDEO_DECODER, FROM_HERE,
153 base::Bind(&VideoReceiver::InitDecoderThread,
154 weak_factory_.GetWeakPtr()));
155 }
156
157 void VideoReceiver::InitDecoderThread() {
158 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::VIDEO_DECODER));
159 video_decoder_->InitDecoder();
160 }
161
150 void VideoReceiver::GetRawVideoFrame( 162 void VideoReceiver::GetRawVideoFrame(
151 const VideoFrameDecodedCallback& callback) { 163 const VideoFrameDecodedCallback& callback) {
152 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 164 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
153 GetEncodedVideoFrame(base::Bind(&VideoReceiver::DecodeVideoFrame, 165 GetEncodedVideoFrame(base::Bind(&VideoReceiver::DecodeVideoFrame,
154 weak_factory_.GetWeakPtr(), 166 weak_factory_.GetWeakPtr(),
155 callback)); 167 callback));
156 } 168 }
157 169
158 // Called when we have a frame to decode. 170 // Called when we have a frame to decode.
159 void VideoReceiver::DecodeVideoFrame( 171 void VideoReceiver::DecodeVideoFrame(
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 469 }
458 470
459 void VideoReceiver::SendNextRtcpReport() { 471 void VideoReceiver::SendNextRtcpReport() {
460 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 472 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
461 rtcp_->SendRtcpFromRtpReceiver(NULL, NULL); 473 rtcp_->SendRtcpFromRtpReceiver(NULL, NULL);
462 ScheduleNextRtcpReport(); 474 ScheduleNextRtcpReport();
463 } 475 }
464 476
465 } // namespace cast 477 } // namespace cast
466 } // namespace media 478 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698