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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc

Issue 2099483002: Add native handle support to SimulcastEncoderAdapter. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: git pull Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc
index 4f389b88ae2b5631dd823fc1964f77beccbb99ed..7b1e9d9d962afebe90cb67047a3dd2ac8dc5c6dc 100644
--- a/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.cc
@@ -289,10 +289,16 @@ int SimulcastEncoderAdapter::Encode(
// If scaling isn't required, because the input resolution
// matches the destination or the input image is empty (e.g.
// a keyframe request for encoders with internal camera
- // sources), pass the image on directly. Otherwise, we'll
- // scale it to match what the encoder expects (below).
+ // sources) or the source image has a native handle, pass the image on
+ // directly. Otherwise, we'll scale it to match what the encoder expects
+ // (below).
+ // For texture frames, the underlying encoder is expected to be able to
+ // correctly sample/scale the source texture.
+ // TODO(perkj): ensure that works going forward, and figure out how this
+ // affects webrtc:5683.
if ((dst_width == src_width && dst_height == src_height) ||
- input_image.IsZeroSize()) {
+ input_image.IsZeroSize() ||
+ input_image.video_frame_buffer()->native_handle()) {
int ret = streaminfos_[stream_idx].encoder->Encode(
input_image, codec_specific_info, &stream_frame_types);
if (ret != WEBRTC_VIDEO_CODEC_OK) {
@@ -510,10 +516,11 @@ void SimulcastEncoderAdapter::OnDroppedFrame() {
bool SimulcastEncoderAdapter::SupportsNativeHandle() const {
// We should not be calling this method before streaminfos_ are configured.
RTC_DCHECK(!streaminfos_.empty());
- // TODO(pbos): Support textures when using more than one encoder.
- if (streaminfos_.size() != 1)
- return false;
- return streaminfos_[0].encoder->SupportsNativeHandle();
+ for (const auto& streaminfo : streaminfos_) {
+ if (!streaminfo.encoder->SupportsNativeHandle())
+ return false;
+ }
+ return true;
}
const char* SimulcastEncoderAdapter::ImplementationName() const {
« no previous file with comments | « no previous file | webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698