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 22 matching lines...) Expand all Loading... |
33 const scoped_refptr<media::VideoFrame>& video_frame, | 33 const scoped_refptr<media::VideoFrame>& video_frame, |
34 const base::TimeTicks& reference_time, | 34 const base::TimeTicks& reference_time, |
35 const VideoEncoderImpl::CodecDynamicConfig& dynamic_config, | 35 const VideoEncoderImpl::CodecDynamicConfig& dynamic_config, |
36 const VideoEncoderImpl::FrameEncodedCallback& frame_encoded_callback) { | 36 const VideoEncoderImpl::FrameEncodedCallback& frame_encoded_callback) { |
37 DCHECK(environment->CurrentlyOn(CastEnvironment::VIDEO)); | 37 DCHECK(environment->CurrentlyOn(CastEnvironment::VIDEO)); |
38 if (dynamic_config.key_frame_requested) { | 38 if (dynamic_config.key_frame_requested) { |
39 encoder->GenerateKeyFrame(); | 39 encoder->GenerateKeyFrame(); |
40 } | 40 } |
41 encoder->UpdateRates(dynamic_config.bit_rate); | 41 encoder->UpdateRates(dynamic_config.bit_rate); |
42 | 42 |
43 scoped_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); | 43 std::unique_ptr<SenderEncodedFrame> encoded_frame(new SenderEncodedFrame()); |
44 encoder->Encode(video_frame, reference_time, encoded_frame.get()); | 44 encoder->Encode(video_frame, reference_time, encoded_frame.get()); |
45 encoded_frame->encode_completion_time = environment->Clock()->NowTicks(); | 45 encoded_frame->encode_completion_time = environment->Clock()->NowTicks(); |
46 environment->PostTask( | 46 environment->PostTask( |
47 CastEnvironment::MAIN, | 47 CastEnvironment::MAIN, |
48 FROM_HERE, | 48 FROM_HERE, |
49 base::Bind(frame_encoded_callback, base::Passed(&encoded_frame))); | 49 base::Bind(frame_encoded_callback, base::Passed(&encoded_frame))); |
50 } | 50 } |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 // static | 53 // static |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 dynamic_config_.bit_rate = new_bit_rate; | 131 dynamic_config_.bit_rate = new_bit_rate; |
132 } | 132 } |
133 | 133 |
134 // Inform the encoder to encode the next frame as a key frame. | 134 // Inform the encoder to encode the next frame as a key frame. |
135 void VideoEncoderImpl::GenerateKeyFrame() { | 135 void VideoEncoderImpl::GenerateKeyFrame() { |
136 dynamic_config_.key_frame_requested = true; | 136 dynamic_config_.key_frame_requested = true; |
137 } | 137 } |
138 | 138 |
139 } // namespace cast | 139 } // namespace cast |
140 } // namespace media | 140 } // namespace media |
OLD | NEW |