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

Side by Side Diff: webrtc/media/base/videoadapter_unittest.cc

Issue 2262443003: Delete VideoFrameFactory, CapturedFrame, and related code. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 4 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) 2010 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2010 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 13 matching lines...) Expand all
24 namespace cricket { 24 namespace cricket {
25 25
26 class VideoAdapterTest : public testing::Test { 26 class VideoAdapterTest : public testing::Test {
27 public: 27 public:
28 virtual void SetUp() { 28 virtual void SetUp() {
29 capturer_.reset(new FakeVideoCapturer); 29 capturer_.reset(new FakeVideoCapturer);
30 capture_format_ = capturer_->GetSupportedFormats()->at(0); 30 capture_format_ = capturer_->GetSupportedFormats()->at(0);
31 capture_format_.interval = VideoFormat::FpsToInterval(30); 31 capture_format_.interval = VideoFormat::FpsToInterval(30);
32 32
33 listener_.reset(new VideoCapturerListener(&adapter_)); 33 listener_.reset(new VideoCapturerListener(&adapter_));
34 #if 0
35 // TODO(nisse): Have to reorganize this test.
34 capturer_->SignalFrameCaptured.connect( 36 capturer_->SignalFrameCaptured.connect(
35 listener_.get(), &VideoCapturerListener::OnFrameCaptured); 37 listener_.get(), &VideoCapturerListener::OnFrameCaptured);
38 #endif
36 } 39 }
37 40
38 virtual void TearDown() { 41 virtual void TearDown() {
39 // Explicitly disconnect the VideoCapturer before to avoid data races 42 // Explicitly disconnect the VideoCapturer before to avoid data races
40 // (frames delivered to VideoCapturerListener while it's being destructed). 43 // (frames delivered to VideoCapturerListener while it's being destructed).
44 #if 0
41 capturer_->SignalFrameCaptured.disconnect_all(); 45 capturer_->SignalFrameCaptured.disconnect_all();
46 #endif
pthatcher1 2016/08/23 00:13:13 And these?
nisse-webrtc 2016/08/23 06:46:39 Same here, needs rewrite to use OnFrame and not us
42 } 47 }
43 48
44 protected: 49 protected:
45 class VideoCapturerListener: public sigslot::has_slots<> { 50 class VideoCapturerListener: public sigslot::has_slots<> {
46 public: 51 public:
47 struct Stats { 52 struct Stats {
48 int captured_frames; 53 int captured_frames;
49 int dropped_frames; 54 int dropped_frames;
50 bool last_adapt_was_no_op; 55 bool last_adapt_was_no_op;
51 56
52 int cropped_width; 57 int cropped_width;
53 int cropped_height; 58 int cropped_height;
54 int out_width; 59 int out_width;
55 int out_height; 60 int out_height;
56 }; 61 };
57 62
58 explicit VideoCapturerListener(VideoAdapter* adapter) 63 explicit VideoCapturerListener(VideoAdapter* adapter)
59 : video_adapter_(adapter), 64 : video_adapter_(adapter),
60 captured_frames_(0), 65 captured_frames_(0),
61 dropped_frames_(0), 66 dropped_frames_(0),
62 last_adapt_was_no_op_(false) { 67 last_adapt_was_no_op_(false) {
68 // TODO(nisse): XXX Silence warning.
69 (void) video_adapter_;
63 } 70 }
64 71
72 #if 0
73 // TODO(nisse): Have to reorganize this test.
65 void OnFrameCaptured(VideoCapturer* capturer, 74 void OnFrameCaptured(VideoCapturer* capturer,
66 const CapturedFrame* captured_frame) { 75 const CapturedFrame* captured_frame) {
67 rtc::CritScope lock(&crit_); 76 rtc::CritScope lock(&crit_);
68 const int in_width = captured_frame->width; 77 const int in_width = captured_frame->width;
69 const int in_height = abs(captured_frame->height); 78 const int in_height = abs(captured_frame->height);
70 int cropped_width; 79 int cropped_width;
71 int cropped_height; 80 int cropped_height;
72 int out_width; 81 int out_width;
73 int out_height; 82 int out_height;
74 if (video_adapter_->AdaptFrameResolution(in_width, in_height, 83 if (video_adapter_->AdaptFrameResolution(in_width, in_height,
75 captured_frame->time_stamp, 84 captured_frame->time_stamp,
76 &cropped_width, &cropped_height, 85 &cropped_width, &cropped_height,
77 &out_width, &out_height)) { 86 &out_width, &out_height)) {
78 cropped_width_ = cropped_width; 87 cropped_width_ = cropped_width;
79 cropped_height_ = cropped_height; 88 cropped_height_ = cropped_height;
80 out_width_ = out_width; 89 out_width_ = out_width;
81 out_height_ = out_height; 90 out_height_ = out_height;
82 last_adapt_was_no_op_ = 91 last_adapt_was_no_op_ =
83 (in_width == cropped_width && in_height == cropped_height && 92 (in_width == cropped_width && in_height == cropped_height &&
84 in_width == out_width && in_height == out_height); 93 in_width == out_width && in_height == out_height);
85 } else { 94 } else {
86 ++dropped_frames_; 95 ++dropped_frames_;
87 } 96 }
88 ++captured_frames_; 97 ++captured_frames_;
89 } 98 }
99 #endif
90 100
91 Stats GetStats() { 101 Stats GetStats() {
92 rtc::CritScope lock(&crit_); 102 rtc::CritScope lock(&crit_);
93 Stats stats; 103 Stats stats;
94 stats.captured_frames = captured_frames_; 104 stats.captured_frames = captured_frames_;
95 stats.dropped_frames = dropped_frames_; 105 stats.dropped_frames = dropped_frames_;
96 stats.last_adapt_was_no_op = last_adapt_was_no_op_; 106 stats.last_adapt_was_no_op = last_adapt_was_no_op_;
97 stats.cropped_width = cropped_width_; 107 stats.cropped_width = cropped_width_;
98 stats.cropped_height = cropped_height_; 108 stats.cropped_height = cropped_height_;
99 stats.out_width = out_width_; 109 stats.out_width = out_width_;
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 956
947 // Instead of getting the exact aspect ratio with cropped resolution 640x360, 957 // Instead of getting the exact aspect ratio with cropped resolution 640x360,
948 // the resolution should be adjusted to get a perfect scale factor instead. 958 // the resolution should be adjusted to get a perfect scale factor instead.
949 EXPECT_EQ(640, cropped_width_); 959 EXPECT_EQ(640, cropped_width_);
950 EXPECT_EQ(368, cropped_height_); 960 EXPECT_EQ(368, cropped_height_);
951 EXPECT_EQ(120, out_width_); 961 EXPECT_EQ(120, out_width_);
952 EXPECT_EQ(69, out_height_); 962 EXPECT_EQ(69, out_height_);
953 } 963 }
954 964
955 } // namespace cricket 965 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698