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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/cast/video_receiver/video_receiver.cc
diff --git a/media/cast/video_receiver/video_receiver.cc b/media/cast/video_receiver/video_receiver.cc
index c637d7a97c6d23fb1eac4f971f1c9de55610cee5..261c4ca78ddf5853ca7e147915de8e3a8a643824 100644
--- a/media/cast/video_receiver/video_receiver.cc
+++ b/media/cast/video_receiver/video_receiver.cc
@@ -124,6 +124,7 @@ VideoReceiver::VideoReceiver(scoped_refptr<CastEnvironment> cast_environment,
max_unacked_frames));
if (!video_config.use_external_decoder) {
video_decoder_.reset(new VideoDecoder(video_config, cast_environment));
+ InitDecoder();
}
rtcp_.reset(
@@ -147,6 +148,17 @@ void VideoReceiver::InitializeTimers() {
ScheduleNextCastMessage();
}
+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
+ cast_environment_->PostTask(CastEnvironment::VIDEO_DECODER, FROM_HERE,
+ base::Bind(&VideoReceiver::InitDecoderThread,
+ weak_factory_.GetWeakPtr()));
+}
+
+void VideoReceiver::InitDecoderThread() {
+ DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::VIDEO_DECODER));
+ video_decoder_->InitDecoder();
+}
+
void VideoReceiver::GetRawVideoFrame(
const VideoFrameDecodedCallback& callback) {
DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));

Powered by Google App Engine
This is Rietveld 408576698