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

Side by Side Diff: webrtc/modules/video_coding/main/source/video_sender.cc

Issue 1158273010: Re-land "Convert native handles to buffers before encoding." (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return VCM_OK; 314 return VCM_OK;
315 } 315 }
316 _mediaOpt.UpdateContentData(contentMetrics); 316 _mediaOpt.UpdateContentData(contentMetrics);
317 // TODO(pbos): Make sure setting send codec is synchronized with video 317 // TODO(pbos): Make sure setting send codec is synchronized with video
318 // processing so frame size always matches. 318 // processing so frame size always matches.
319 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(), 319 if (!_codecDataBase.MatchesCurrentResolution(videoFrame.width(),
320 videoFrame.height())) { 320 videoFrame.height())) {
321 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping."; 321 LOG(LS_ERROR) << "Incoming frame doesn't match set resolution. Dropping.";
322 return VCM_PARAMETER_ERROR; 322 return VCM_PARAMETER_ERROR;
323 } 323 }
324 VideoFrame converted_frame = videoFrame;
325 if (converted_frame.native_handle() && !_encoder->SupportsNativeHandle()) {
326 // This module only supports software encoding.
327 // TODO(pbos): Offload conversion from the encoder thread.
328 converted_frame = converted_frame.ConvertNativeToI420Frame();
329 CHECK(!converted_frame.IsZeroSize())
330 << "Frame conversion failed, won't be able to encode frame.";
331 }
324 int32_t ret = 332 int32_t ret =
325 _encoder->Encode(videoFrame, codecSpecificInfo, _nextFrameTypes); 333 _encoder->Encode(converted_frame, codecSpecificInfo, _nextFrameTypes);
326 if (ret < 0) { 334 if (ret < 0) {
327 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret; 335 LOG(LS_ERROR) << "Failed to encode frame. Error code: " << ret;
328 return ret; 336 return ret;
329 } 337 }
330 for (size_t i = 0; i < _nextFrameTypes.size(); ++i) { 338 for (size_t i = 0; i < _nextFrameTypes.size(); ++i) {
331 _nextFrameTypes[i] = kVideoFrameDelta; // Default frame type. 339 _nextFrameTypes[i] = kVideoFrameDelta; // Default frame type.
332 } 340 }
333 return VCM_OK; 341 return VCM_OK;
334 } 342 }
335 343
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 int window_bps = std::max(threshold_bps / 10, 10000); 378 int window_bps = std::max(threshold_bps / 10, 10000);
371 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); 379 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps);
372 } 380 }
373 381
374 bool VideoSender::VideoSuspended() const { 382 bool VideoSender::VideoSuspended() const {
375 CriticalSectionScoped cs(_sendCritSect); 383 CriticalSectionScoped cs(_sendCritSect);
376 return _mediaOpt.IsVideoSuspended(); 384 return _mediaOpt.IsVideoSuspended();
377 } 385 }
378 } // namespace vcm 386 } // namespace vcm
379 } // namespace webrtc 387 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/video_coding/main/source/generic_encoder.cc ('k') | webrtc/test/fake_texture_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698