Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
| 8 #include "content/child/child_process.h" | 8 #include "content/child/child_process.h" |
| 9 #include "content/renderer/media/canvas_capture_handler.h" | 9 #include "content/renderer/media/canvas_capture_handler.h" |
| 10 #include "content/renderer/media/media_stream_video_capturer_source.h" | 10 #include "content/renderer/media/media_stream_video_capturer_source.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 | 93 |
| 94 void OnVerifyDeliveredFrame( | 94 void OnVerifyDeliveredFrame( |
| 95 bool opaque, | 95 bool opaque, |
| 96 const scoped_refptr<media::VideoFrame>& video_frame, | 96 const scoped_refptr<media::VideoFrame>& video_frame, |
| 97 base::TimeTicks estimated_capture_time) { | 97 base::TimeTicks estimated_capture_time) { |
| 98 if (opaque) | 98 if (opaque) |
| 99 EXPECT_EQ(media::PIXEL_FORMAT_I420, video_frame->format()); | 99 EXPECT_EQ(media::PIXEL_FORMAT_I420, video_frame->format()); |
| 100 else | 100 else |
| 101 EXPECT_EQ(media::PIXEL_FORMAT_YV12A, video_frame->format()); | 101 EXPECT_EQ(media::PIXEL_FORMAT_YV12A, video_frame->format()); |
| 102 | 102 |
| 103 EXPECT_EQ(video_frame->timestamp().InMilliseconds(), | |
|
Lei Zhang
2016/03/10 21:44:02
This has been failing on memory.fyi bots, e.g.
ht
| |
| 104 (estimated_capture_time - base::TimeTicks()).InMilliseconds()); | |
| 103 const gfx::Size& size = video_frame->coded_size(); | 105 const gfx::Size& size = video_frame->coded_size(); |
| 104 EXPECT_EQ(kTestCanvasCaptureFrameWidth, size.width()); | 106 EXPECT_EQ(kTestCanvasCaptureFrameWidth, size.width()); |
| 105 EXPECT_EQ(kTestCanvasCaptureFrameHeight, size.height()); | 107 EXPECT_EQ(kTestCanvasCaptureFrameHeight, size.height()); |
| 106 const uint8_t* y_plane = video_frame->data(media::VideoFrame::kYPlane); | 108 const uint8_t* y_plane = video_frame->data(media::VideoFrame::kYPlane); |
| 107 EXPECT_NEAR(74, y_plane[0], kTestCanvasCaptureFrameErrorTolerance); | 109 EXPECT_NEAR(74, y_plane[0], kTestCanvasCaptureFrameErrorTolerance); |
| 108 const uint8_t* u_plane = video_frame->data(media::VideoFrame::kUPlane); | 110 const uint8_t* u_plane = video_frame->data(media::VideoFrame::kUPlane); |
| 109 EXPECT_NEAR(193, u_plane[0], kTestCanvasCaptureFrameErrorTolerance); | 111 EXPECT_NEAR(193, u_plane[0], kTestCanvasCaptureFrameErrorTolerance); |
| 110 const uint8_t* v_plane = video_frame->data(media::VideoFrame::kVPlane); | 112 const uint8_t* v_plane = video_frame->data(media::VideoFrame::kVPlane); |
| 111 EXPECT_NEAR(105, v_plane[0], kTestCanvasCaptureFrameErrorTolerance); | 113 EXPECT_NEAR(105, v_plane[0], kTestCanvasCaptureFrameErrorTolerance); |
| 112 if (!opaque) { | 114 if (!opaque) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 track_.source().getExtraData())); | 214 track_.source().getExtraData())); |
| 213 EXPECT_TRUE(source != nullptr); | 215 EXPECT_TRUE(source != nullptr); |
| 214 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame()); | 216 EXPECT_TRUE(canvas_capture_handler_->needsNewFrame()); |
| 215 source->StopCapture(); | 217 source->StopCapture(); |
| 216 EXPECT_FALSE(canvas_capture_handler_->needsNewFrame()); | 218 EXPECT_FALSE(canvas_capture_handler_->needsNewFrame()); |
| 217 } | 219 } |
| 218 | 220 |
| 219 INSTANTIATE_TEST_CASE_P(, CanvasCaptureHandlerTest, ::testing::Bool()); | 221 INSTANTIATE_TEST_CASE_P(, CanvasCaptureHandlerTest, ::testing::Bool()); |
| 220 | 222 |
| 221 } // namespace content | 223 } // namespace content |
| OLD | NEW |