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, int32_t id) | 25 FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory, int32_t id) |
25 : factory_(factory), | 26 : factory_(factory), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 83 } |
83 VideoCaptureEncodeInterface* GetEncodeInterface( | 84 VideoCaptureEncodeInterface* GetEncodeInterface( |
84 const webrtc::VideoCodec& codec) override { | 85 const webrtc::VideoCodec& codec) override { |
85 return NULL; // not implemented | 86 return NULL; // not implemented |
86 } | 87 } |
87 | 88 |
88 void SendFrame(int w, int h) { | 89 void SendFrame(int w, int h) { |
89 if (!running_) return; | 90 if (!running_) return; |
90 | 91 |
91 rtc::scoped_refptr<webrtc::I420Buffer> buffer = | 92 rtc::scoped_refptr<webrtc::I420Buffer> buffer = |
92 new rtc::RefCountedObject<webrtc::I420Buffer>(w, h); | 93 webrtc::I420Buffer::Create(w, h); |
93 // Initialize memory to satisfy DrMemory tests. See | 94 // Initialize memory to satisfy DrMemory tests. See |
94 // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 | 95 // https://bugs.chromium.org/p/libyuv/issues/detail?id=377 |
95 buffer->InitializeData(); | 96 buffer->InitializeData(); |
96 if (callback_) { | 97 if (callback_) { |
97 callback_->OnIncomingCapturedFrame( | 98 callback_->OnIncomingCapturedFrame( |
98 id_, | 99 id_, |
99 webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); | 100 webrtc::VideoFrame(buffer, 0, 0, webrtc::kVideoRotation_0)); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 const webrtc::VideoCaptureCapability& cap() const { | 104 const webrtc::VideoCaptureCapability& cap() const { |
104 return cap_; | 105 return cap_; |
105 } | 106 } |
106 | 107 |
107 private: | 108 private: |
108 FakeWebRtcVcmFactory* factory_; | 109 FakeWebRtcVcmFactory* factory_; |
109 int id_; | 110 int id_; |
110 webrtc::VideoCaptureDataCallback* callback_; | 111 webrtc::VideoCaptureDataCallback* callback_; |
111 bool running_; | 112 bool running_; |
112 webrtc::VideoCaptureCapability cap_; | 113 webrtc::VideoCaptureCapability cap_; |
113 int delay_; | 114 int delay_; |
114 }; | 115 }; |
115 | 116 |
116 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 117 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
OLD | NEW |