OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * Copyright 2004 Google Inc. | |
4 * | 3 * |
5 * Redistribution and use in source and binary forms, with or without | 4 * Use of this source code is governed by a BSD-style license |
6 * modification, are permitted provided that the following conditions are met: | 5 * that can be found in the LICENSE file in the root of the source |
7 * | 6 * tree. An additional intellectual property rights grant can be found |
8 * 1. Redistributions of source code must retain the above copyright notice, | 7 * in the file PATENTS. All contributing project authors may |
9 * this list of conditions and the following disclaimer. | 8 * be found in the AUTHORS file in the root of the source tree. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | |
11 * this list of conditions and the following disclaimer in the documentation | |
12 * and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED | |
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | |
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | 9 */ |
27 | 10 |
28 #include "talk/media/base/testutils.h" | 11 #include "webrtc/media/base/testutils.h" |
29 | 12 |
30 #include <math.h> | 13 #include <math.h> |
31 #include <algorithm> | 14 #include <algorithm> |
32 | 15 |
33 #include "talk/media/base/executablehelpers.h" | |
34 #include "talk/media/base/rtpdump.h" | |
35 #include "talk/media/base/videocapturer.h" | |
36 #include "talk/media/base/videoframe.h" | |
37 #include "webrtc/base/bytebuffer.h" | 16 #include "webrtc/base/bytebuffer.h" |
38 #include "webrtc/base/fileutils.h" | 17 #include "webrtc/base/fileutils.h" |
39 #include "webrtc/base/gunit.h" | 18 #include "webrtc/base/gunit.h" |
40 #include "webrtc/base/pathutils.h" | 19 #include "webrtc/base/pathutils.h" |
41 #include "webrtc/base/stream.h" | 20 #include "webrtc/base/stream.h" |
42 #include "webrtc/base/stringutils.h" | 21 #include "webrtc/base/stringutils.h" |
43 #include "webrtc/base/testutils.h" | 22 #include "webrtc/base/testutils.h" |
| 23 #include "webrtc/media/base/executablehelpers.h" |
| 24 #include "webrtc/media/base/rtpdump.h" |
| 25 #include "webrtc/media/base/videocapturer.h" |
| 26 #include "webrtc/media/base/videoframe.h" |
44 | 27 |
45 namespace cricket { | 28 namespace cricket { |
46 | 29 |
47 ///////////////////////////////////////////////////////////////////////// | 30 ///////////////////////////////////////////////////////////////////////// |
48 // Implementation of RawRtpPacket | 31 // Implementation of RawRtpPacket |
49 ///////////////////////////////////////////////////////////////////////// | 32 ///////////////////////////////////////////////////////////////////////// |
50 void RawRtpPacket::WriteToByteBuffer(uint32_t in_ssrc, | 33 void RawRtpPacket::WriteToByteBuffer(uint32_t in_ssrc, |
51 rtc::ByteBuffer* buf) const { | 34 rtc::ByteBuffer* buf) const { |
52 if (!buf) return; | 35 if (!buf) return; |
53 | 36 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 if (1 == frame_count_) { | 234 if (1 == frame_count_) { |
252 frame_fourcc_ = frame->fourcc; | 235 frame_fourcc_ = frame->fourcc; |
253 frame_width_ = frame->width; | 236 frame_width_ = frame->width; |
254 frame_height_ = frame->height; | 237 frame_height_ = frame->height; |
255 frame_size_ = frame->data_size; | 238 frame_size_ = frame->data_size; |
256 } else if (frame_width_ != frame->width || frame_height_ != frame->height) { | 239 } else if (frame_width_ != frame->width || frame_height_ != frame->height) { |
257 resolution_changed_ = true; | 240 resolution_changed_ = true; |
258 } | 241 } |
259 } | 242 } |
260 | 243 |
261 // Returns the absolute path to a file in the testdata/ directory. | 244 // Returns the absolute path to a file in the resources/ directory. |
262 std::string GetTestFilePath(const std::string& filename) { | 245 std::string GetTestFilePath(const std::string& filename) { |
263 // Locate test data directory. | 246 // Locate test data directory. |
264 #ifdef ENABLE_WEBRTC | 247 #ifdef ENABLE_WEBRTC |
265 rtc::Pathname path = rtc::GetExecutablePath(); | 248 rtc::Pathname path = rtc::GetExecutablePath(); |
266 EXPECT_FALSE(path.empty()); | 249 EXPECT_FALSE(path.empty()); |
267 path.AppendPathname("../../talk/"); | 250 path.AppendPathname("../../resources/"); |
268 #else | 251 #else |
269 rtc::Pathname path = testing::GetTalkDirectory(); | 252 rtc::Pathname path = testing::GetTalkDirectory(); |
270 EXPECT_FALSE(path.empty()); // must be run from inside "talk" | 253 EXPECT_FALSE(path.empty()); // must be run from inside "talk" |
271 #endif | 254 #endif |
272 path.AppendFolder("media/testdata/"); | 255 path.AppendFolder("media/"); |
273 path.SetFilename(filename); | 256 path.SetFilename(filename); |
274 return path.pathname(); | 257 return path.pathname(); |
275 } | 258 } |
276 | 259 |
277 // Loads the image with the specified prefix and size into |out|. | 260 // Loads the image with the specified prefix and size into |out|. |
278 bool LoadPlanarYuvTestImage(const std::string& prefix, | 261 bool LoadPlanarYuvTestImage(const std::string& prefix, |
279 int width, | 262 int width, |
280 int height, | 263 int height, |
281 uint8_t* out) { | 264 uint8_t* out) { |
282 std::stringstream ss; | 265 std::stringstream ss; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 std::vector<uint32_t> fid_ssrcs; | 359 std::vector<uint32_t> fid_ssrcs; |
377 fid_ssrcs.push_back(ssrcs[i]); | 360 fid_ssrcs.push_back(ssrcs[i]); |
378 fid_ssrcs.push_back(rtx_ssrcs[i]); | 361 fid_ssrcs.push_back(rtx_ssrcs[i]); |
379 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs); | 362 cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs); |
380 sp.ssrc_groups.push_back(fid_group); | 363 sp.ssrc_groups.push_back(fid_group); |
381 } | 364 } |
382 return sp; | 365 return sp; |
383 } | 366 } |
384 | 367 |
385 } // namespace cricket | 368 } // namespace cricket |
OLD | NEW |