| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 encoder->Encode(video_frame, reference_time, encoded_frame.get()); | 47 encoder->Encode(video_frame, reference_time, encoded_frame.get()); |
| 48 environment->PostTask( | 48 environment->PostTask( |
| 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 int max_unacked_frames) | |
| 59 : cast_environment_(cast_environment) { | 58 : cast_environment_(cast_environment) { |
| 60 if (video_config.codec == CODEC_VIDEO_VP8) { | 59 if (video_config.codec == CODEC_VIDEO_VP8) { |
| 61 encoder_.reset(new Vp8Encoder(video_config, max_unacked_frames)); | 60 encoder_.reset(new Vp8Encoder(video_config)); |
| 62 cast_environment_->PostTask(CastEnvironment::VIDEO, | 61 cast_environment_->PostTask(CastEnvironment::VIDEO, |
| 63 FROM_HERE, | 62 FROM_HERE, |
| 64 base::Bind(&InitializeEncoderOnEncoderThread, | 63 base::Bind(&InitializeEncoderOnEncoderThread, |
| 65 cast_environment, | 64 cast_environment, |
| 66 encoder_.get())); | 65 encoder_.get())); |
| 67 #ifndef OFFICIAL_BUILD | 66 #ifndef OFFICIAL_BUILD |
| 68 } else if (video_config.codec == CODEC_VIDEO_FAKE) { | 67 } else if (video_config.codec == CODEC_VIDEO_FAKE) { |
| 69 encoder_.reset(new FakeSoftwareVideoEncoder(video_config)); | 68 encoder_.reset(new FakeSoftwareVideoEncoder(video_config)); |
| 70 #endif | 69 #endif |
| 71 } else { | 70 } else { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 dynamic_config_.key_frame_requested = true; | 116 dynamic_config_.key_frame_requested = true; |
| 118 } | 117 } |
| 119 | 118 |
| 120 // Inform the encoder to only reference frames older or equal to frame_id; | 119 // Inform the encoder to only reference frames older or equal to frame_id; |
| 121 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { | 120 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { |
| 122 dynamic_config_.latest_frame_id_to_reference = frame_id; | 121 dynamic_config_.latest_frame_id_to_reference = frame_id; |
| 123 } | 122 } |
| 124 | 123 |
| 125 } // namespace cast | 124 } // namespace cast |
| 126 } // namespace media | 125 } // namespace media |
| OLD | NEW |