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/sender/video_encoder_impl.h" | 5 #include "media/cast/sender/video_encoder_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 base::Bind( | 66 base::Bind( |
67 frame_encoded_callback, base::Passed(&encoded_frame))); | 67 frame_encoded_callback, base::Passed(&encoded_frame))); |
68 } | 68 } |
69 } // namespace | 69 } // namespace |
70 | 70 |
71 VideoEncoderImpl::VideoEncoderImpl( | 71 VideoEncoderImpl::VideoEncoderImpl( |
72 scoped_refptr<CastEnvironment> cast_environment, | 72 scoped_refptr<CastEnvironment> cast_environment, |
73 const VideoSenderConfig& video_config, | 73 const VideoSenderConfig& video_config, |
74 int max_unacked_frames) | 74 int max_unacked_frames) |
75 : cast_environment_(cast_environment) { | 75 : cast_environment_(cast_environment) { |
| 76 CHECK(cast_environment_->HasVideoThread()); |
76 if (video_config.codec == CODEC_VIDEO_VP8) { | 77 if (video_config.codec == CODEC_VIDEO_VP8) { |
77 #if !defined(MEDIA_DISABLE_LIBVPX) | 78 #if !defined(MEDIA_DISABLE_LIBVPX) |
78 encoder_.reset(new Vp8Encoder(video_config, max_unacked_frames)); | 79 encoder_.reset(new Vp8Encoder(video_config, max_unacked_frames)); |
79 cast_environment_->PostTask(CastEnvironment::VIDEO, | 80 cast_environment_->PostTask(CastEnvironment::VIDEO, |
80 FROM_HERE, | 81 FROM_HERE, |
81 base::Bind(&InitializeEncoderOnEncoderThread, | 82 base::Bind(&InitializeEncoderOnEncoderThread, |
82 cast_environment, | 83 cast_environment, |
83 encoder_.get())); | 84 encoder_.get())); |
84 #endif // !defined(MEDIA_DISABLE_LIBVPX) | 85 #endif // !defined(MEDIA_DISABLE_LIBVPX) |
85 #ifndef OFFICIAL_BUILD | 86 #ifndef OFFICIAL_BUILD |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 dynamic_config_.key_frame_requested = true; | 136 dynamic_config_.key_frame_requested = true; |
136 } | 137 } |
137 | 138 |
138 // Inform the encoder to only reference frames older or equal to frame_id; | 139 // Inform the encoder to only reference frames older or equal to frame_id; |
139 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { | 140 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { |
140 dynamic_config_.latest_frame_id_to_reference = frame_id; | 141 dynamic_config_.latest_frame_id_to_reference = frame_id; |
141 } | 142 } |
142 | 143 |
143 } // namespace cast | 144 } // namespace cast |
144 } // namespace media | 145 } // namespace media |
OLD | NEW |