Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webrtc/test/fake_encoder.h

Issue 2573453002: Add multithreaded fake encoder and corresponding FlexFEC VideoSendStreamTest. (Closed)
Patch Set: Fix android. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/test/fake_encoder.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 (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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_TEST_FAKE_ENCODER_H_ 11 #ifndef WEBRTC_TEST_FAKE_ENCODER_H_
12 #define WEBRTC_TEST_FAKE_ENCODER_H_ 12 #define WEBRTC_TEST_FAKE_ENCODER_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "webrtc/base/criticalsection.h" 16 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/base/task_queue.h"
17 #include "webrtc/common_types.h" 18 #include "webrtc/common_types.h"
18 #include "webrtc/system_wrappers/include/clock.h" 19 #include "webrtc/system_wrappers/include/clock.h"
19 #include "webrtc/video_encoder.h" 20 #include "webrtc/video_encoder.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 namespace test { 23 namespace test {
23 24
24 class FakeEncoder : public VideoEncoder { 25 class FakeEncoder : public VideoEncoder {
25 public: 26 public:
26 explicit FakeEncoder(Clock* clock); 27 explicit FakeEncoder(Clock* clock);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 80
80 void SetDelay(int delay_ms); 81 void SetDelay(int delay_ms);
81 int32_t Encode(const VideoFrame& input_image, 82 int32_t Encode(const VideoFrame& input_image,
82 const CodecSpecificInfo* codec_specific_info, 83 const CodecSpecificInfo* codec_specific_info,
83 const std::vector<FrameType>* frame_types) override; 84 const std::vector<FrameType>* frame_types) override;
84 85
85 private: 86 private:
86 rtc::CriticalSection lock_; 87 rtc::CriticalSection lock_;
87 int delay_ms_ GUARDED_BY(&lock_); 88 int delay_ms_ GUARDED_BY(&lock_);
88 }; 89 };
90
91 // This class implements a multi-threaded fake encoder by posting
92 // FakeH264Encoder::Encode(.) tasks to |queue1_| and |queue2_|, in an
93 // alternating fashion.
94 class MultiThreadedFakeH264Encoder : public test::FakeH264Encoder {
95 public:
96 MultiThreadedFakeH264Encoder(Clock* clock);
97 virtual ~MultiThreadedFakeH264Encoder() override;
98
99 int32_t Encode(const VideoFrame& input_image,
100 const CodecSpecificInfo* codec_specific_info,
101 const std::vector<FrameType>* frame_types) override;
102
103 int32_t EncodeCallback(const VideoFrame& input_image,
104 const CodecSpecificInfo* codec_specific_info,
105 const std::vector<FrameType>* frame_types);
106
107 protected:
108 class EncodeTask;
109
110 int current_queue_;
111 rtc::TaskQueue queue1_;
112 rtc::TaskQueue queue2_;
113 };
114
89 } // namespace test 115 } // namespace test
90 } // namespace webrtc 116 } // namespace webrtc
91 117
92 #endif // WEBRTC_TEST_FAKE_ENCODER_H_ 118 #endif // WEBRTC_TEST_FAKE_ENCODER_H_
OLDNEW
« no previous file with comments | « no previous file | webrtc/test/fake_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698