OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/size_adaptable_video_encoder_base.h" | 5 #include "media/cast/sender/size_adaptable_video_encoder_base.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (encoder_) | 72 if (encoder_) |
73 encoder_->SetBitRate(new_bit_rate); | 73 encoder_->SetBitRate(new_bit_rate); |
74 } | 74 } |
75 | 75 |
76 void SizeAdaptableVideoEncoderBase::GenerateKeyFrame() { | 76 void SizeAdaptableVideoEncoderBase::GenerateKeyFrame() { |
77 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 77 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
78 if (encoder_) | 78 if (encoder_) |
79 encoder_->GenerateKeyFrame(); | 79 encoder_->GenerateKeyFrame(); |
80 } | 80 } |
81 | 81 |
82 scoped_ptr<VideoFrameFactory> | 82 std::unique_ptr<VideoFrameFactory> |
83 SizeAdaptableVideoEncoderBase::CreateVideoFrameFactory() { | 83 SizeAdaptableVideoEncoderBase::CreateVideoFrameFactory() { |
84 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 84 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
85 return nullptr; | 85 return nullptr; |
86 } | 86 } |
87 | 87 |
88 void SizeAdaptableVideoEncoderBase::EmitFrames() { | 88 void SizeAdaptableVideoEncoderBase::EmitFrames() { |
89 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 89 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
90 if (encoder_) | 90 if (encoder_) |
91 encoder_->EmitFrames(); | 91 encoder_->EmitFrames(); |
92 } | 92 } |
93 | 93 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 status == STATUS_INITIALIZED) { | 145 status == STATUS_INITIALIZED) { |
146 // Begin using the replacement encoder. | 146 // Begin using the replacement encoder. |
147 frames_in_encoder_ = 0; | 147 frames_in_encoder_ = 0; |
148 OnEncoderReplaced(encoder_.get()); | 148 OnEncoderReplaced(encoder_.get()); |
149 } | 149 } |
150 status_change_cb_.Run(status); | 150 status_change_cb_.Run(status); |
151 } | 151 } |
152 | 152 |
153 void SizeAdaptableVideoEncoderBase::OnEncodedVideoFrame( | 153 void SizeAdaptableVideoEncoderBase::OnEncodedVideoFrame( |
154 const FrameEncodedCallback& frame_encoded_callback, | 154 const FrameEncodedCallback& frame_encoded_callback, |
155 scoped_ptr<SenderEncodedFrame> encoded_frame) { | 155 std::unique_ptr<SenderEncodedFrame> encoded_frame) { |
156 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); | 156 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); |
157 --frames_in_encoder_; | 157 --frames_in_encoder_; |
158 DCHECK_GE(frames_in_encoder_, 0); | 158 DCHECK_GE(frames_in_encoder_, 0); |
159 last_frame_id_ = encoded_frame->frame_id; | 159 last_frame_id_ = encoded_frame->frame_id; |
160 frame_encoded_callback.Run(std::move(encoded_frame)); | 160 frame_encoded_callback.Run(std::move(encoded_frame)); |
161 } | 161 } |
162 | 162 |
163 } // namespace cast | 163 } // namespace cast |
164 } // namespace media | 164 } // namespace media |
OLD | NEW |