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

Unified Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.cc

Issue 2695653002: Add support for creating HW codecs in VideoProcessor tests. (Closed)
Patch Set: Created 3 years, 10 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
Index: webrtc/modules/video_coding/codecs/test/videoprocessor.cc
diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
index 3df8a042f014c06f531cd1f75a245e3157a70a97..61973e0770b0d1bf576c405337b898f56f963af3 100644
--- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
+++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc
@@ -346,7 +346,11 @@ void VideoProcessorImpl::FrameDecoded(const VideoFrame& image) {
config_.codec_settings->height));
// Should be the same aspect ratio, no cropping needed.
- up_image->ScaleFrom(*image.video_frame_buffer());
+ if (image.video_frame_buffer()->native_handle()) {
+ up_image->ScaleFrom(*image.video_frame_buffer()->NativeToI420Buffer());
+ } else {
+ up_image->ScaleFrom(*image.video_frame_buffer());
+ }
// TODO(mikhal): Extracting the buffer for now - need to update test.
size_t length =
@@ -367,7 +371,15 @@ void VideoProcessorImpl::FrameDecoded(const VideoFrame& image) {
// TODO(mikhal): Add as a member function, so won't be allocated per frame.
size_t length = CalcBufferSize(kI420, image.width(), image.height());
std::unique_ptr<uint8_t[]> image_buffer(new uint8_t[length]);
- int extracted_length = ExtractBuffer(image, length, image_buffer.get());
+ int extracted_length;
+ if (image.video_frame_buffer()->native_handle()) {
+ extracted_length =
+ ExtractBuffer(image.video_frame_buffer()->NativeToI420Buffer(),
+ length, image_buffer.get());
+ } else {
+ extracted_length =
+ ExtractBuffer(image.video_frame_buffer(), length, image_buffer.get());
+ }
RTC_DCHECK_GT(extracted_length, 0);
memcpy(last_successful_frame_buffer_.get(), image_buffer.get(),
extracted_length);

Powered by Google App Engine
This is Rietveld 408576698