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

Side by Side Diff: webrtc/media/base/videoframe_unittest.h

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Trivial rebase. 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 unified diff | Download patch
« no previous file with comments | « webrtc/media/base/videoframe.cc ('k') | webrtc/media/base/videoframefactory.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 /* 1 /*
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2004 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 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 void CopyIsRef() { 1804 void CopyIsRef() {
1805 std::unique_ptr<T> source(new T); 1805 std::unique_ptr<T> source(new T);
1806 std::unique_ptr<const cricket::VideoFrame> target; 1806 std::unique_ptr<const cricket::VideoFrame> target;
1807 ASSERT_TRUE(LoadFrameNoRepeat(source.get())); 1807 ASSERT_TRUE(LoadFrameNoRepeat(source.get()));
1808 target.reset(source->Copy()); 1808 target.reset(source->Copy());
1809 EXPECT_TRUE(IsEqual(*source, *target, 0)); 1809 EXPECT_TRUE(IsEqual(*source, *target, 0));
1810 const T* const_source = source.get(); 1810 const T* const_source = source.get();
1811 EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer()); 1811 EXPECT_EQ(const_source->video_frame_buffer(), target->video_frame_buffer());
1812 } 1812 }
1813 1813
1814 void StretchToFrame() {
1815 // Create the source frame as a black frame.
1816 rtc::scoped_refptr<webrtc::I420Buffer> buffer(
1817 new rtc::RefCountedObject<webrtc::I420Buffer>(kWidth * 2, kHeight * 2));
1818
1819 buffer->SetToBlack();
1820 T source(buffer, 0, webrtc::kVideoRotation_0);
1821
1822 EXPECT_TRUE(IsSize(source, kWidth * 2, kHeight * 2));
1823
1824 // Create the target frame by loading from a file.
1825 T target1;
1826 ASSERT_TRUE(LoadFrameNoRepeat(&target1));
1827 EXPECT_FALSE(IsBlack(target1));
1828
1829 // Stretch and check if the stretched target is black.
1830 source.StretchToFrame(&target1, true, false);
1831 EXPECT_TRUE(IsBlack(target1));
1832
1833 // Crop and stretch and check if the stretched target is black.
1834 T target2;
1835 ASSERT_TRUE(LoadFrameNoRepeat(&target2));
1836 source.StretchToFrame(&target2, true, true);
1837 EXPECT_TRUE(IsBlack(target2));
1838 EXPECT_EQ(source.GetTimeStamp(), target2.GetTimeStamp());
1839 }
1840
1841 int repeat_; 1814 int repeat_;
1842 }; 1815 };
1843 1816
1844 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_ 1817 #endif // WEBRTC_MEDIA_BASE_VIDEOFRAME_UNITTEST_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/videoframe.cc ('k') | webrtc/media/base/videoframefactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698