OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/optional.h" | 8 #include "base/optional.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 const int kInputWidth = 1280; | 99 const int kInputWidth = 1280; |
100 const int kInputHeight = 720; | 100 const int kInputHeight = 720; |
101 const gfx::Size kSize(kInputWidth, kInputHeight); | 101 const gfx::Size kSize(kInputWidth, kInputHeight); |
102 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::CreateFrame( | 102 scoped_refptr<media::VideoFrame> frame = media::VideoFrame::CreateFrame( |
103 media::PIXEL_FORMAT_I420, kSize, gfx::Rect(kSize), kSize, | 103 media::PIXEL_FORMAT_I420, kSize, gfx::Rect(kSize), kSize, |
104 base::TimeDelta()); | 104 base::TimeDelta()); |
105 | 105 |
106 // Request smaller scale to make sure scaling normally kicks in. | 106 // Request smaller scale to make sure scaling normally kicks in. |
107 rtc::VideoSinkWants wants; | 107 rtc::VideoSinkWants wants; |
108 wants.max_pixel_count = rtc::Optional<int>(kInputWidth * kInputHeight / 2); | 108 // TODO(sprang): Remove this type hack when webrtc has updated the sink |
| 109 // wants api. https://codereview.webrtc.org/2781433002/ |
| 110 using MaxPixelCountType = decltype(wants.max_pixel_count); |
| 111 wants.max_pixel_count = MaxPixelCountType(kInputWidth * kInputHeight / 2); |
109 adapter_->AddOrUpdateSink(this, wants); | 112 adapter_->AddOrUpdateSink(this, wants); |
110 | 113 |
111 adapter_->OnFrameCaptured(frame); | 114 adapter_->OnFrameCaptured(frame); |
112 if (expect_initial_downscale) { | 115 if (expect_initial_downscale) { |
113 EXPECT_LT(output_frame_width_, kInputWidth); | 116 EXPECT_LT(output_frame_width_, kInputWidth); |
114 EXPECT_LT(output_frame_height_, kInputHeight); | 117 EXPECT_LT(output_frame_height_, kInputHeight); |
115 } else { | 118 } else { |
116 EXPECT_EQ(kInputWidth, output_frame_width_); | 119 EXPECT_EQ(kInputWidth, output_frame_width_); |
117 EXPECT_EQ(kInputHeight, output_frame_height_); | 120 EXPECT_EQ(kInputHeight, output_frame_height_); |
118 } | 121 } |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 191 |
189 TEST_F(WebRtcVideoCapturerAdapterTest, RespectsConstructionTimeContentHint) { | 192 TEST_F(WebRtcVideoCapturerAdapterTest, RespectsConstructionTimeContentHint) { |
190 // Non-screenshare adapter constructed with detail content hint should not | 193 // Non-screenshare adapter constructed with detail content hint should not |
191 // adapt before SetContentHint is run. | 194 // adapt before SetContentHint is run. |
192 TestContentHintResolutionAdaptation( | 195 TestContentHintResolutionAdaptation( |
193 false, blink::WebMediaStreamTrack::ContentHintType::VideoDetail, false, | 196 false, blink::WebMediaStreamTrack::ContentHintType::VideoDetail, false, |
194 blink::WebMediaStreamTrack::ContentHintType::VideoMotion, true); | 197 blink::WebMediaStreamTrack::ContentHintType::VideoMotion, true); |
195 } | 198 } |
196 | 199 |
197 } // namespace content | 200 } // namespace content |
OLD | NEW |