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

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

Issue 1544313002: Convert Pass()→std::move() in //media (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « media/cast/sender/frame_sender.cc ('k') | media/cast/sender/video_encoder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "media/base/video_frame.h" 11 #include "media/base/video_frame.h"
10 12
11 namespace media { 13 namespace media {
12 namespace cast { 14 namespace cast {
13 15
14 SizeAdaptableVideoEncoderBase::SizeAdaptableVideoEncoderBase( 16 SizeAdaptableVideoEncoderBase::SizeAdaptableVideoEncoderBase(
15 const scoped_refptr<CastEnvironment>& cast_environment, 17 const scoped_refptr<CastEnvironment>& cast_environment,
16 const VideoSenderConfig& video_config, 18 const VideoSenderConfig& video_config,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (frames_in_encoder_ == kEncoderIsInitializing) 127 if (frames_in_encoder_ == kEncoderIsInitializing)
126 return; // Already spawned. 128 return; // Already spawned.
127 129
128 DestroyEncoder(); 130 DestroyEncoder();
129 frames_in_encoder_ = kEncoderIsInitializing; 131 frames_in_encoder_ = kEncoderIsInitializing;
130 OnEncoderStatusChange(STATUS_CODEC_REINIT_PENDING); 132 OnEncoderStatusChange(STATUS_CODEC_REINIT_PENDING);
131 VLOG(1) << "Creating replacement video encoder (for frame size change from " 133 VLOG(1) << "Creating replacement video encoder (for frame size change from "
132 << frame_size_.ToString() << " to " 134 << frame_size_.ToString() << " to "
133 << size_needed.ToString() << ")."; 135 << size_needed.ToString() << ").";
134 frame_size_ = size_needed; 136 frame_size_ = size_needed;
135 encoder_ = CreateEncoder().Pass(); 137 encoder_ = CreateEncoder();
136 DCHECK(encoder_); 138 DCHECK(encoder_);
137 } 139 }
138 140
139 void SizeAdaptableVideoEncoderBase::OnEncoderStatusChange( 141 void SizeAdaptableVideoEncoderBase::OnEncoderStatusChange(
140 OperationalStatus status) { 142 OperationalStatus status) {
141 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 143 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
142 if (frames_in_encoder_ == kEncoderIsInitializing && 144 if (frames_in_encoder_ == kEncoderIsInitializing &&
143 status == STATUS_INITIALIZED) { 145 status == STATUS_INITIALIZED) {
144 // Begin using the replacement encoder. 146 // Begin using the replacement encoder.
145 frames_in_encoder_ = 0; 147 frames_in_encoder_ = 0;
146 OnEncoderReplaced(encoder_.get()); 148 OnEncoderReplaced(encoder_.get());
147 } 149 }
148 status_change_cb_.Run(status); 150 status_change_cb_.Run(status);
149 } 151 }
150 152
151 void SizeAdaptableVideoEncoderBase::OnEncodedVideoFrame( 153 void SizeAdaptableVideoEncoderBase::OnEncodedVideoFrame(
152 const FrameEncodedCallback& frame_encoded_callback, 154 const FrameEncodedCallback& frame_encoded_callback,
153 scoped_ptr<SenderEncodedFrame> encoded_frame) { 155 scoped_ptr<SenderEncodedFrame> encoded_frame) {
154 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 156 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
155 --frames_in_encoder_; 157 --frames_in_encoder_;
156 DCHECK_GE(frames_in_encoder_, 0); 158 DCHECK_GE(frames_in_encoder_, 0);
157 last_frame_id_ = encoded_frame->frame_id; 159 last_frame_id_ = encoded_frame->frame_id;
158 frame_encoded_callback.Run(encoded_frame.Pass()); 160 frame_encoded_callback.Run(std::move(encoded_frame));
159 } 161 }
160 162
161 } // namespace cast 163 } // namespace cast
162 } // namespace media 164 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/sender/frame_sender.cc ('k') | media/cast/sender/video_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698