OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 static const int kViEChannelIdBase = 0; | 57 static const int kViEChannelIdBase = 0; |
58 static const int kViEChannelIdMax = 1000; | 58 static const int kViEChannelIdMax = 1000; |
59 | 59 |
60 // Fake class for mocking out webrtc::VideoDecoder | 60 // Fake class for mocking out webrtc::VideoDecoder |
61 class FakeWebRtcVideoDecoder : public webrtc::VideoDecoder { | 61 class FakeWebRtcVideoDecoder : public webrtc::VideoDecoder { |
62 public: | 62 public: |
63 FakeWebRtcVideoDecoder() | 63 FakeWebRtcVideoDecoder() |
64 : num_frames_received_(0) { | 64 : num_frames_received_(0) { |
65 } | 65 } |
66 | 66 |
67 virtual int32 InitDecode(const webrtc::VideoCodec*, int32) { | 67 virtual int32_t InitDecode(const webrtc::VideoCodec*, int32_t) { |
68 return WEBRTC_VIDEO_CODEC_OK; | 68 return WEBRTC_VIDEO_CODEC_OK; |
69 } | 69 } |
70 | 70 |
71 virtual int32 Decode( | 71 virtual int32_t Decode(const webrtc::EncodedImage&, |
72 const webrtc::EncodedImage&, bool, const webrtc::RTPFragmentationHeader*, | 72 bool, |
73 const webrtc::CodecSpecificInfo*, int64_t) { | 73 const webrtc::RTPFragmentationHeader*, |
| 74 const webrtc::CodecSpecificInfo*, |
| 75 int64_t) { |
74 num_frames_received_++; | 76 num_frames_received_++; |
75 return WEBRTC_VIDEO_CODEC_OK; | 77 return WEBRTC_VIDEO_CODEC_OK; |
76 } | 78 } |
77 | 79 |
78 virtual int32 RegisterDecodeCompleteCallback( | 80 virtual int32_t RegisterDecodeCompleteCallback( |
79 webrtc::DecodedImageCallback*) { | 81 webrtc::DecodedImageCallback*) { |
80 return WEBRTC_VIDEO_CODEC_OK; | 82 return WEBRTC_VIDEO_CODEC_OK; |
81 } | 83 } |
82 | 84 |
83 virtual int32 Release() { | 85 virtual int32_t Release() { return WEBRTC_VIDEO_CODEC_OK; } |
84 return WEBRTC_VIDEO_CODEC_OK; | |
85 } | |
86 | 86 |
87 virtual int32 Reset() { | 87 virtual int32_t Reset() { return WEBRTC_VIDEO_CODEC_OK; } |
88 return WEBRTC_VIDEO_CODEC_OK; | |
89 } | |
90 | 88 |
91 int GetNumFramesReceived() const { | 89 int GetNumFramesReceived() const { |
92 return num_frames_received_; | 90 return num_frames_received_; |
93 } | 91 } |
94 | 92 |
95 private: | 93 private: |
96 int num_frames_received_; | 94 int num_frames_received_; |
97 }; | 95 }; |
98 | 96 |
99 // Fake class for mocking out WebRtcVideoDecoderFactory. | 97 // Fake class for mocking out WebRtcVideoDecoderFactory. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 std::set<webrtc::VideoCodecType> supported_codec_types_; | 135 std::set<webrtc::VideoCodecType> supported_codec_types_; |
138 std::vector<FakeWebRtcVideoDecoder*> decoders_; | 136 std::vector<FakeWebRtcVideoDecoder*> decoders_; |
139 int num_created_decoders_; | 137 int num_created_decoders_; |
140 }; | 138 }; |
141 | 139 |
142 // Fake class for mocking out webrtc::VideoEnoder | 140 // Fake class for mocking out webrtc::VideoEnoder |
143 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { | 141 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { |
144 public: | 142 public: |
145 FakeWebRtcVideoEncoder() : num_frames_encoded_(0) {} | 143 FakeWebRtcVideoEncoder() : num_frames_encoded_(0) {} |
146 | 144 |
147 virtual int32 InitEncode(const webrtc::VideoCodec* codecSettings, | 145 virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings, |
148 int32 numberOfCores, | 146 int32_t numberOfCores, |
149 size_t maxPayloadSize) { | 147 size_t maxPayloadSize) { |
150 rtc::CritScope lock(&crit_); | 148 rtc::CritScope lock(&crit_); |
151 codec_settings_ = *codecSettings; | 149 codec_settings_ = *codecSettings; |
152 return WEBRTC_VIDEO_CODEC_OK; | 150 return WEBRTC_VIDEO_CODEC_OK; |
153 } | 151 } |
154 | 152 |
155 webrtc::VideoCodec GetCodecSettings() { | 153 webrtc::VideoCodec GetCodecSettings() { |
156 rtc::CritScope lock(&crit_); | 154 rtc::CritScope lock(&crit_); |
157 return codec_settings_; | 155 return codec_settings_; |
158 } | 156 } |
159 | 157 |
160 virtual int32 Encode(const webrtc::VideoFrame& inputImage, | 158 virtual int32_t Encode( |
161 const webrtc::CodecSpecificInfo* codecSpecificInfo, | 159 const webrtc::VideoFrame& inputImage, |
162 const std::vector<webrtc::VideoFrameType>* frame_types) { | 160 const webrtc::CodecSpecificInfo* codecSpecificInfo, |
| 161 const std::vector<webrtc::VideoFrameType>* frame_types) { |
163 rtc::CritScope lock(&crit_); | 162 rtc::CritScope lock(&crit_); |
164 ++num_frames_encoded_; | 163 ++num_frames_encoded_; |
165 return WEBRTC_VIDEO_CODEC_OK; | 164 return WEBRTC_VIDEO_CODEC_OK; |
166 } | 165 } |
167 | 166 |
168 virtual int32 RegisterEncodeCompleteCallback( | 167 virtual int32_t RegisterEncodeCompleteCallback( |
169 webrtc::EncodedImageCallback* callback) { | 168 webrtc::EncodedImageCallback* callback) { |
170 return WEBRTC_VIDEO_CODEC_OK; | 169 return WEBRTC_VIDEO_CODEC_OK; |
171 } | 170 } |
172 | 171 |
173 virtual int32 Release() { | 172 virtual int32_t Release() { return WEBRTC_VIDEO_CODEC_OK; } |
| 173 |
| 174 virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) { |
174 return WEBRTC_VIDEO_CODEC_OK; | 175 return WEBRTC_VIDEO_CODEC_OK; |
175 } | 176 } |
176 | 177 |
177 virtual int32 SetChannelParameters(uint32 packetLoss, | 178 virtual int32_t SetRates(uint32_t newBitRate, uint32_t frameRate) { |
178 int64_t rtt) { | |
179 return WEBRTC_VIDEO_CODEC_OK; | 179 return WEBRTC_VIDEO_CODEC_OK; |
180 } | 180 } |
181 | 181 |
182 virtual int32 SetRates(uint32 newBitRate, | |
183 uint32 frameRate) { | |
184 return WEBRTC_VIDEO_CODEC_OK; | |
185 } | |
186 | |
187 int GetNumEncodedFrames() { | 182 int GetNumEncodedFrames() { |
188 rtc::CritScope lock(&crit_); | 183 rtc::CritScope lock(&crit_); |
189 return num_frames_encoded_; | 184 return num_frames_encoded_; |
190 } | 185 } |
191 | 186 |
192 private: | 187 private: |
193 rtc::CriticalSection crit_; | 188 rtc::CriticalSection crit_; |
194 int num_frames_encoded_ GUARDED_BY(crit_); | 189 int num_frames_encoded_ GUARDED_BY(crit_); |
195 webrtc::VideoCodec codec_settings_ GUARDED_BY(crit_); | 190 webrtc::VideoCodec codec_settings_ GUARDED_BY(crit_); |
196 }; | 191 }; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 std::set<webrtc::VideoCodecType> supported_codec_types_; | 247 std::set<webrtc::VideoCodecType> supported_codec_types_; |
253 std::vector<WebRtcVideoEncoderFactory::VideoCodec> codecs_; | 248 std::vector<WebRtcVideoEncoderFactory::VideoCodec> codecs_; |
254 std::vector<FakeWebRtcVideoEncoder*> encoders_; | 249 std::vector<FakeWebRtcVideoEncoder*> encoders_; |
255 int num_created_encoders_; | 250 int num_created_encoders_; |
256 bool encoders_have_internal_sources_; | 251 bool encoders_have_internal_sources_; |
257 }; | 252 }; |
258 | 253 |
259 } // namespace cricket | 254 } // namespace cricket |
260 | 255 |
261 #endif // TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_ | 256 #endif // TALK_MEDIA_WEBRTC_FAKEWEBRTCVIDEOENGINE_H_ |
OLD | NEW |