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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 CastEnvironment::MAIN, | 49 CastEnvironment::MAIN, |
50 FROM_HERE, | 50 FROM_HERE, |
51 base::Bind(frame_encoded_callback, base::Passed(&encoded_frame))); | 51 base::Bind(frame_encoded_callback, base::Passed(&encoded_frame))); |
52 } | 52 } |
53 } // namespace | 53 } // namespace |
54 | 54 |
55 VideoEncoderImpl::VideoEncoderImpl( | 55 VideoEncoderImpl::VideoEncoderImpl( |
56 scoped_refptr<CastEnvironment> cast_environment, | 56 scoped_refptr<CastEnvironment> cast_environment, |
57 const VideoSenderConfig& video_config) | 57 const VideoSenderConfig& video_config) |
58 : cast_environment_(cast_environment) { | 58 : cast_environment_(cast_environment) { |
| 59 CHECK(cast_environment_->HasVideoThread()); |
59 if (video_config.codec == CODEC_VIDEO_VP8) { | 60 if (video_config.codec == CODEC_VIDEO_VP8) { |
60 encoder_.reset(new Vp8Encoder(video_config)); | 61 encoder_.reset(new Vp8Encoder(video_config)); |
61 cast_environment_->PostTask(CastEnvironment::VIDEO, | 62 cast_environment_->PostTask(CastEnvironment::VIDEO, |
62 FROM_HERE, | 63 FROM_HERE, |
63 base::Bind(&InitializeEncoderOnEncoderThread, | 64 base::Bind(&InitializeEncoderOnEncoderThread, |
64 cast_environment, | 65 cast_environment, |
65 encoder_.get())); | 66 encoder_.get())); |
66 #ifndef OFFICIAL_BUILD | 67 #ifndef OFFICIAL_BUILD |
67 } else if (video_config.codec == CODEC_VIDEO_FAKE) { | 68 } else if (video_config.codec == CODEC_VIDEO_FAKE) { |
68 encoder_.reset(new FakeSoftwareVideoEncoder(video_config)); | 69 encoder_.reset(new FakeSoftwareVideoEncoder(video_config)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 dynamic_config_.key_frame_requested = true; | 117 dynamic_config_.key_frame_requested = true; |
117 } | 118 } |
118 | 119 |
119 // Inform the encoder to only reference frames older or equal to frame_id; | 120 // Inform the encoder to only reference frames older or equal to frame_id; |
120 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { | 121 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { |
121 dynamic_config_.latest_frame_id_to_reference = frame_id; | 122 dynamic_config_.latest_frame_id_to_reference = frame_id; |
122 } | 123 } |
123 | 124 |
124 } // namespace cast | 125 } // namespace cast |
125 } // namespace media | 126 } // namespace media |
OLD | NEW |