Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: media/cast/sender/size_adaptable_video_encoder_base.cc

Issue 1913503002: Memory copy the VideoFrame to match the requirement for HW encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 // Encoding was exited with errors.
miu 2016/05/03 19:05:43 nit: Simplify: if (encoded_frame) last_fram
xjz 2016/05/03 23:30:15 Done.
160 if (!encoded_frame) {
161 frame_encoded_callback.Run(std::move(encoded_frame));
162 return;
163 }
164
159 last_frame_id_ = encoded_frame->frame_id; 165 last_frame_id_ = encoded_frame->frame_id;
160 frame_encoded_callback.Run(std::move(encoded_frame)); 166 frame_encoded_callback.Run(std::move(encoded_frame));
161 } 167 }
162 168
163 } // namespace cast 169 } // namespace cast
164 } // namespace media 170 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698