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 25 matching lines...) Expand all Loading... |
36 const VideoEncoderImpl::CodecDynamicConfig& dynamic_config, | 36 const VideoEncoderImpl::CodecDynamicConfig& dynamic_config, |
37 const VideoEncoderImpl::FrameEncodedCallback& frame_encoded_callback) { | 37 const VideoEncoderImpl::FrameEncodedCallback& frame_encoded_callback) { |
38 DCHECK(environment->CurrentlyOn(CastEnvironment::VIDEO)); | 38 DCHECK(environment->CurrentlyOn(CastEnvironment::VIDEO)); |
39 if (dynamic_config.key_frame_requested) { | 39 if (dynamic_config.key_frame_requested) { |
40 encoder->GenerateKeyFrame(); | 40 encoder->GenerateKeyFrame(); |
41 } | 41 } |
42 encoder->LatestFrameIdToReference( | 42 encoder->LatestFrameIdToReference( |
43 dynamic_config.latest_frame_id_to_reference); | 43 dynamic_config.latest_frame_id_to_reference); |
44 encoder->UpdateRates(dynamic_config.bit_rate); | 44 encoder->UpdateRates(dynamic_config.bit_rate); |
45 | 45 |
46 scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); | 46 scoped_ptr<EncodedFrame> encoded_frame(new EncodedFrame()); |
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 // static | 55 // static |
56 bool VideoEncoderImpl::IsSupported(const VideoSenderConfig& video_config) { | 56 bool VideoEncoderImpl::IsSupported(const VideoSenderConfig& video_config) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 dynamic_config_.key_frame_requested = true; | 139 dynamic_config_.key_frame_requested = true; |
140 } | 140 } |
141 | 141 |
142 // Inform the encoder to only reference frames older or equal to frame_id; | 142 // Inform the encoder to only reference frames older or equal to frame_id; |
143 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { | 143 void VideoEncoderImpl::LatestFrameIdToReference(uint32 frame_id) { |
144 dynamic_config_.latest_frame_id_to_reference = frame_id; | 144 dynamic_config_.latest_frame_id_to_reference = frame_id; |
145 } | 145 } |
146 | 146 |
147 } // namespace cast | 147 } // namespace cast |
148 } // namespace media | 148 } // namespace media |
OLD | NEW |