| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/media/capture/desktop_capture_device.h" | 5 #include "content/browser/media/capture/desktop_capture_device.h" |
| 6 | 6 |
| 7 #include <string> |
| 8 |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 8 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 9 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
| 10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 11 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | 16 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" |
| 15 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | 17 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 16 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 18 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 const media::VideoCaptureFormat& buffer_format, | 56 const media::VideoCaptureFormat& buffer_format, |
| 55 const scoped_refptr<media::VideoFrame>& frame, | 57 const scoped_refptr<media::VideoFrame>& frame, |
| 56 base::TimeTicks timestamp)); | 58 base::TimeTicks timestamp)); |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 // DesktopFrame wrapper that flips wrapped frame upside down by inverting | 61 // DesktopFrame wrapper that flips wrapped frame upside down by inverting |
| 60 // stride. | 62 // stride. |
| 61 class InvertedDesktopFrame : public webrtc::DesktopFrame { | 63 class InvertedDesktopFrame : public webrtc::DesktopFrame { |
| 62 public: | 64 public: |
| 63 // Takes ownership of |frame|. | 65 // Takes ownership of |frame|. |
| 64 InvertedDesktopFrame(webrtc::DesktopFrame* frame) | 66 explicit InvertedDesktopFrame(webrtc::DesktopFrame* frame) |
| 65 : webrtc::DesktopFrame( | 67 : webrtc::DesktopFrame( |
| 66 frame->size(), -frame->stride(), | 68 frame->size(), |
| 69 -frame->stride(), |
| 67 frame->data() + (frame->size().height() - 1) * frame->stride(), | 70 frame->data() + (frame->size().height() - 1) * frame->stride(), |
| 68 frame->shared_memory()), | 71 frame->shared_memory()), |
| 69 original_frame_(frame) { | 72 original_frame_(frame) { |
| 70 set_dpi(frame->dpi()); | 73 set_dpi(frame->dpi()); |
| 71 set_capture_time_ms(frame->capture_time_ms()); | 74 set_capture_time_ms(frame->capture_time_ms()); |
| 72 mutable_updated_region()->Swap(frame->mutable_updated_region()); | 75 mutable_updated_region()->Swap(frame->mutable_updated_region()); |
| 73 } | 76 } |
| 74 virtual ~InvertedDesktopFrame() {} | 77 virtual ~InvertedDesktopFrame() {} |
| 75 | 78 |
| 76 private: | 79 private: |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 269 |
| 267 capture_device_->StopAndDeAllocate(); | 270 capture_device_->StopAndDeAllocate(); |
| 268 | 271 |
| 269 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); | 272 EXPECT_EQ(kTestFrameWidth1, format.frame_size.width()); |
| 270 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height()); | 273 EXPECT_EQ(kTestFrameHeight1, format.frame_size.height()); |
| 271 EXPECT_EQ(kFrameRate, format.frame_rate); | 274 EXPECT_EQ(kFrameRate, format.frame_rate); |
| 272 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); | 275 EXPECT_EQ(media::PIXEL_FORMAT_ARGB, format.pixel_format); |
| 273 } | 276 } |
| 274 | 277 |
| 275 } // namespace content | 278 } // namespace content |
| OLD | NEW |