Chromium Code Reviews

Side by Side Diff: webrtc/api/test/fakeperiodicvideocapturer.h

Issue 1740963002: Revert of Removed unused cricket::VideoCapturer methods (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « webrtc/api/androidvideocapturer.cc ('k') | webrtc/api/videosource.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 // FakePeriodicVideoCapturer implements a fake cricket::VideoCapturer that 11 // FakePeriodicVideoCapturer implements a fake cricket::VideoCapturer that
12 // creates video frames periodically after it has been started. 12 // creates video frames periodically after it has been started.
13 13
14 #ifndef WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_ 14 #ifndef WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_
15 #define WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_ 15 #define WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_
16 16
17 #include "webrtc/base/thread.h" 17 #include "webrtc/base/thread.h"
18 #include "webrtc/media/base/fakevideocapturer.h" 18 #include "webrtc/media/base/fakevideocapturer.h"
19 19
20 namespace webrtc { 20 namespace webrtc {
21 21
22 class FakePeriodicVideoCapturer : public cricket::FakeVideoCapturer, 22 class FakePeriodicVideoCapturer : public cricket::FakeVideoCapturer {
23 public rtc::MessageHandler {
24 public: 23 public:
25 FakePeriodicVideoCapturer() { 24 FakePeriodicVideoCapturer() {
26 std::vector<cricket::VideoFormat> formats; 25 std::vector<cricket::VideoFormat> formats;
27 formats.push_back(cricket::VideoFormat(1280, 720, 26 formats.push_back(cricket::VideoFormat(1280, 720,
28 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); 27 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
29 formats.push_back(cricket::VideoFormat(640, 480, 28 formats.push_back(cricket::VideoFormat(640, 480,
30 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); 29 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
31 formats.push_back(cricket::VideoFormat(640, 360, 30 formats.push_back(cricket::VideoFormat(640, 360,
32 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420)); 31 cricket::VideoFormat::FpsToInterval(30), cricket::FOURCC_I420));
33 formats.push_back(cricket::VideoFormat(320, 240, 32 formats.push_back(cricket::VideoFormat(320, 240,
(...skipping 15 matching lines...)
49 } 48 }
50 // Inherited from MesageHandler. 49 // Inherited from MesageHandler.
51 virtual void OnMessage(rtc::Message* msg) { 50 virtual void OnMessage(rtc::Message* msg) {
52 if (msg->message_id == MSG_CREATEFRAME) { 51 if (msg->message_id == MSG_CREATEFRAME) {
53 if (IsRunning()) { 52 if (IsRunning()) {
54 CaptureFrame(); 53 CaptureFrame();
55 rtc::Thread::Current()->PostDelayed(static_cast<int>( 54 rtc::Thread::Current()->PostDelayed(static_cast<int>(
56 GetCaptureFormat()->interval / rtc::kNumNanosecsPerMillisec), 55 GetCaptureFormat()->interval / rtc::kNumNanosecsPerMillisec),
57 this, MSG_CREATEFRAME); 56 this, MSG_CREATEFRAME);
58 } 57 }
58 } else {
59 FakeVideoCapturer::OnMessage(msg);
59 } 60 }
60 } 61 }
61 62
62 private: 63 private:
63 enum { 64 enum {
64 // Offset 0xFF to make sure this don't collide with base class messages. 65 // Offset 0xFF to make sure this don't collide with base class messages.
65 MSG_CREATEFRAME = 0xFF 66 MSG_CREATEFRAME = 0xFF
66 }; 67 };
67 }; 68 };
68 69
69 } // namespace webrtc 70 } // namespace webrtc
70 71
71 #endif // WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_ 72 #endif // WEBRTC_API_TEST_FAKEPERIODICVIDEOCAPTURER_H_
OLDNEW
« no previous file with comments | « webrtc/api/androidvideocapturer.cc ('k') | webrtc/api/videosource.cc » ('j') | no next file with comments »

Powered by Google App Engine