OLD | NEW |
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 |
11 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 11 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
12 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 12 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
| 16 #include "webrtc/api/video/i420_buffer.h" |
16 #include "webrtc/media/base/testutils.h" | 17 #include "webrtc/media/base/testutils.h" |
17 #include "webrtc/media/engine/webrtcvideocapturer.h" | 18 #include "webrtc/media/engine/webrtcvideocapturer.h" |
18 | 19 |
19 class FakeWebRtcVcmFactory; | 20 class FakeWebRtcVcmFactory; |
20 | 21 |
21 // Fake class for mocking out webrtc::VideoCaptureModule. | 22 // Fake class for mocking out webrtc::VideoCaptureModule. |
22 class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { | 23 class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { |
23 public: | 24 public: |
24 FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory) | 25 FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory) |
25 : factory_(factory), | 26 : factory_(factory), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bool SetApplyRotation(bool enable) override { | 59 bool SetApplyRotation(bool enable) override { |
59 return true; // ignored | 60 return true; // ignored |
60 } | 61 } |
61 bool GetApplyRotation() override { | 62 bool GetApplyRotation() override { |
62 return true; // Rotation compensation is turned on. | 63 return true; // Rotation compensation is turned on. |
63 } | 64 } |
64 void SendFrame(int w, int h) { | 65 void SendFrame(int w, int h) { |
65 if (!running_) return; | 66 if (!running_) return; |
66 | 67 |
67 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | 68 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
68 new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); | 69 webrtc::I420Buffer::Create(w, h); |
69 // Initialize memory to satisfy DrMemory tests. See | 70 // Initialize memory to satisfy DrMemory tests. See |
70 // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 | 71 // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 |
71 buffer->InitializeData(); | 72 buffer->InitializeData(); |
72 if (callback_) { | 73 if (callback_) { |
73 callback_->OnFrame( | 74 callback_->OnFrame( |
74 webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); | 75 webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 const webrtc::VideoCaptureCapability& cap() const { | 79 const webrtc::VideoCaptureCapability& cap() const { |
79 return cap_; | 80 return cap_; |
80 } | 81 } |
81 | 82 |
82 private: | 83 private: |
83 FakeWebRtcVcmFactory* factory_; | 84 FakeWebRtcVcmFactory* factory_; |
84 rtc::VideoSinkInterface<webrtc::VideoFrame>* callback_; | 85 rtc::VideoSinkInterface<webrtc::VideoFrame>* callback_; |
85 bool running_; | 86 bool running_; |
86 webrtc::VideoCaptureCapability cap_; | 87 webrtc::VideoCaptureCapability cap_; |
87 }; | 88 }; |
88 | 89 |
89 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 90 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
OLD | NEW |