OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2010 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 webrtc::VideoCodecType type) { | 84 webrtc::VideoCodecType type) { |
85 if (supported_codec_types_.count(type) == 0) { | 85 if (supported_codec_types_.count(type) == 0) { |
86 return NULL; | 86 return NULL; |
87 } | 87 } |
88 FakeWebRtcVideoDecoder* decoder = new FakeWebRtcVideoDecoder(); | 88 FakeWebRtcVideoDecoder* decoder = new FakeWebRtcVideoDecoder(); |
89 decoders_.push_back(decoder); | 89 decoders_.push_back(decoder); |
90 num_created_decoders_++; | 90 num_created_decoders_++; |
91 return decoder; | 91 return decoder; |
92 } | 92 } |
93 | 93 |
| 94 virtual webrtc::VideoDecoder* CreateVideoDecoderWithParams( |
| 95 webrtc::VideoCodecType type, |
| 96 VideoDecoderParams params) { |
| 97 params_.push_back(params); |
| 98 return CreateVideoDecoder(type); |
| 99 } |
| 100 |
94 virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) { | 101 virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) { |
95 decoders_.erase( | 102 decoders_.erase( |
96 std::remove(decoders_.begin(), decoders_.end(), decoder), | 103 std::remove(decoders_.begin(), decoders_.end(), decoder), |
97 decoders_.end()); | 104 decoders_.end()); |
98 delete decoder; | 105 delete decoder; |
99 } | 106 } |
100 | 107 |
101 void AddSupportedVideoCodecType(webrtc::VideoCodecType type) { | 108 void AddSupportedVideoCodecType(webrtc::VideoCodecType type) { |
102 supported_codec_types_.insert(type); | 109 supported_codec_types_.insert(type); |
103 } | 110 } |
104 | 111 |
105 int GetNumCreatedDecoders() { | 112 int GetNumCreatedDecoders() { |
106 return num_created_decoders_; | 113 return num_created_decoders_; |
107 } | 114 } |
108 | 115 |
109 const std::vector<FakeWebRtcVideoDecoder*>& decoders() { | 116 const std::vector<FakeWebRtcVideoDecoder*>& decoders() { |
110 return decoders_; | 117 return decoders_; |
111 } | 118 } |
112 | 119 |
| 120 const std::vector<VideoDecoderParams>& params() { return params_; } |
| 121 |
113 private: | 122 private: |
114 std::set<webrtc::VideoCodecType> supported_codec_types_; | 123 std::set<webrtc::VideoCodecType> supported_codec_types_; |
115 std::vector<FakeWebRtcVideoDecoder*> decoders_; | 124 std::vector<FakeWebRtcVideoDecoder*> decoders_; |
116 int num_created_decoders_; | 125 int num_created_decoders_; |
| 126 std::vector<VideoDecoderParams> params_; |
117 }; | 127 }; |
118 | 128 |
119 // Fake class for mocking out webrtc::VideoEnoder | 129 // Fake class for mocking out webrtc::VideoEnoder |
120 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { | 130 class FakeWebRtcVideoEncoder : public webrtc::VideoEncoder { |
121 public: | 131 public: |
122 FakeWebRtcVideoEncoder() | 132 FakeWebRtcVideoEncoder() |
123 : init_encode_event_(false, false), num_frames_encoded_(0) {} | 133 : init_encode_event_(false, false), num_frames_encoded_(0) {} |
124 | 134 |
125 virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings, | 135 virtual int32_t InitEncode(const webrtc::VideoCodec* codecSettings, |
126 int32_t numberOfCores, | 136 int32_t numberOfCores, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 std::set<webrtc::VideoCodecType> supported_codec_types_; | 258 std::set<webrtc::VideoCodecType> supported_codec_types_; |
249 std::vector<WebRtcVideoEncoderFactory::VideoCodec> codecs_; | 259 std::vector<WebRtcVideoEncoderFactory::VideoCodec> codecs_; |
250 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_); | 260 std::vector<FakeWebRtcVideoEncoder*> encoders_ GUARDED_BY(crit_); |
251 int num_created_encoders_ GUARDED_BY(crit_); | 261 int num_created_encoders_ GUARDED_BY(crit_); |
252 bool encoders_have_internal_sources_; | 262 bool encoders_have_internal_sources_; |
253 }; | 263 }; |
254 | 264 |
255 } // namespace cricket | 265 } // namespace cricket |
256 | 266 |
257 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_ | 267 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCVIDEOENGINE_H_ |
OLD | NEW |