| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // Fake class for mocking out webrtc::VideoCaptureModule. | 21 // Fake class for mocking out webrtc::VideoCaptureModule. |
| 22 class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { | 22 class FakeWebRtcVideoCaptureModule : public webrtc::VideoCaptureModule { |
| 23 public: | 23 public: |
| 24 FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory, int32_t id) | 24 FakeWebRtcVideoCaptureModule(FakeWebRtcVcmFactory* factory, int32_t id) |
| 25 : factory_(factory), | 25 : factory_(factory), |
| 26 id_(id), | 26 id_(id), |
| 27 callback_(NULL), | 27 callback_(NULL), |
| 28 running_(false), | 28 running_(false), |
| 29 delay_(0) { | 29 delay_(0) { |
| 30 } | 30 } |
| 31 ~FakeWebRtcVideoCaptureModule(); |
| 31 int64_t TimeUntilNextProcess() override { return 0; } | 32 int64_t TimeUntilNextProcess() override { return 0; } |
| 32 void Process() override {} | 33 void Process() override {} |
| 33 void RegisterCaptureDataCallback( | 34 void RegisterCaptureDataCallback( |
| 34 webrtc::VideoCaptureDataCallback& callback) override { | 35 webrtc::VideoCaptureDataCallback& callback) override { |
| 35 callback_ = &callback; | 36 callback_ = &callback; |
| 36 } | 37 } |
| 37 void DeRegisterCaptureDataCallback() override { callback_ = NULL; } | 38 void DeRegisterCaptureDataCallback() override { callback_ = NULL; } |
| 38 void RegisterCaptureCallback( | 39 void RegisterCaptureCallback( |
| 39 webrtc::VideoCaptureFeedBack& callback) override { | 40 webrtc::VideoCaptureFeedBack& callback) override { |
| 40 // Not implemented. | 41 // Not implemented. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 bool SetApplyRotation(bool enable) override { | 77 bool SetApplyRotation(bool enable) override { |
| 77 return false; // not implemented | 78 return false; // not implemented |
| 78 } | 79 } |
| 79 bool GetApplyRotation() override { | 80 bool GetApplyRotation() override { |
| 80 return true; // Rotation compensation is turned on. | 81 return true; // Rotation compensation is turned on. |
| 81 } | 82 } |
| 82 VideoCaptureEncodeInterface* GetEncodeInterface( | 83 VideoCaptureEncodeInterface* GetEncodeInterface( |
| 83 const webrtc::VideoCodec& codec) override { | 84 const webrtc::VideoCodec& codec) override { |
| 84 return NULL; // not implemented | 85 return NULL; // not implemented |
| 85 } | 86 } |
| 86 int32_t AddRef() const override { return 0; } | |
| 87 int32_t Release() const override { | |
| 88 delete this; | |
| 89 return 0; | |
| 90 } | |
| 91 | 87 |
| 92 void SendFrame(int w, int h) { | 88 void SendFrame(int w, int h) { |
| 93 if (!running_) return; | 89 if (!running_) return; |
| 94 webrtc::VideoFrame sample; | 90 webrtc::VideoFrame sample; |
| 95 // Setting stride based on width. | 91 // Setting stride based on width. |
| 96 sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2); | 92 sample.CreateEmptyFrame(w, h, w, (w + 1) / 2, (w + 1) / 2); |
| 97 if (callback_) { | 93 if (callback_) { |
| 98 callback_->OnIncomingCapturedFrame(id_, sample); | 94 callback_->OnIncomingCapturedFrame(id_, sample); |
| 99 } | 95 } |
| 100 } | 96 } |
| 101 | 97 |
| 102 const webrtc::VideoCaptureCapability& cap() const { | 98 const webrtc::VideoCaptureCapability& cap() const { |
| 103 return cap_; | 99 return cap_; |
| 104 } | 100 } |
| 105 | 101 |
| 106 private: | 102 private: |
| 107 // Ref-counted, use Release() instead. | |
| 108 ~FakeWebRtcVideoCaptureModule(); | |
| 109 | |
| 110 FakeWebRtcVcmFactory* factory_; | 103 FakeWebRtcVcmFactory* factory_; |
| 111 int id_; | 104 int id_; |
| 112 webrtc::VideoCaptureDataCallback* callback_; | 105 webrtc::VideoCaptureDataCallback* callback_; |
| 113 bool running_; | 106 bool running_; |
| 114 webrtc::VideoCaptureCapability cap_; | 107 webrtc::VideoCaptureCapability cap_; |
| 115 int delay_; | 108 int delay_; |
| 116 }; | 109 }; |
| 117 | 110 |
| 118 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ | 111 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOCAPTUREMODULE_H_ |
| OLD | NEW |