Re-land "Convert native handles to buffers before encoding."

This reverts commit a67675506c9057bd9ffd4d76aae8b743343d434d.

BUG=webrtc:4081
TBR=magjed@webrtc.org

Review URL: https://codereview.webrtc.org/1158273010

Cr-Commit-Position: refs/heads/master@{#9381}
This commit is contained in:
Peter Boström
2015-06-05 11:08:03 +02:00
parent 3fbf3f8841
commit eb66e800d1
19 changed files with 211 additions and 143 deletions

View File

@ -60,6 +60,11 @@ class VideoEncoderSoftwareFallbackWrapperTest : public ::testing::Test {
void OnDroppedFrame() override { ++on_dropped_frame_count_; }
bool SupportsNativeHandle() const override {
++supports_native_handle_count_;
return false;
}
int init_encode_count_ = 0;
int32_t init_encode_return_code_ = WEBRTC_VIDEO_CODEC_OK;
int encode_count_ = 0;
@ -68,6 +73,7 @@ class VideoEncoderSoftwareFallbackWrapperTest : public ::testing::Test {
int set_channel_parameters_count_ = 0;
int set_rates_count_ = 0;
int on_dropped_frame_count_ = 0;
mutable int supports_native_handle_count_ = 0;
};
class FakeEncodedImageCallback : public EncodedImageCallback {
@ -197,4 +203,18 @@ TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release());
}
TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
SupportsNativeHandleForwardedWithoutFallback) {
fallback_wrapper_.SupportsNativeHandle();
EXPECT_EQ(1, fake_encoder_.supports_native_handle_count_);
}
TEST_F(VideoEncoderSoftwareFallbackWrapperTest,
SupportsNativeHandleNotForwardedDuringFallback) {
UtilizeFallbackEncoder();
fallback_wrapper_.SupportsNativeHandle();
EXPECT_EQ(0, fake_encoder_.supports_native_handle_count_);
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, fallback_wrapper_.Release());
}
} // namespace webrtc