2013-07-10 00:45:36 +00:00
|
|
|
/*
|
|
|
|
|
* libjingle
|
|
|
|
|
* Copyright 2004 Google Inc.
|
|
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#ifndef WEBRTC_MEDIA_BASE_TESTUTILS_H_
|
|
|
|
|
#define WEBRTC_MEDIA_BASE_TESTUTILS_H_
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
2013-08-30 21:24:16 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
#include "libyuv/compare.h"
|
2015-11-10 23:44:30 -08:00
|
|
|
#include "webrtc/base/arraysize.h"
|
2014-08-13 17:26:08 +00:00
|
|
|
#include "webrtc/base/basictypes.h"
|
|
|
|
|
#include "webrtc/base/sigslot.h"
|
|
|
|
|
#include "webrtc/base/window.h"
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#include "webrtc/media/base/mediachannel.h"
|
|
|
|
|
#include "webrtc/media/base/videocapturer.h"
|
|
|
|
|
#include "webrtc/media/base/videocommon.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
namespace rtc {
|
2013-07-10 00:45:36 +00:00
|
|
|
class ByteBuffer;
|
|
|
|
|
class StreamInterface;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
// Returns size of 420 image with rounding on chroma for odd sizes.
|
|
|
|
|
#define I420_SIZE(w, h) (w * h + (((w + 1) / 2) * ((h + 1) / 2)) * 2)
|
|
|
|
|
// Returns size of ARGB image.
|
|
|
|
|
#define ARGB_SIZE(w, h) (w * h * 4)
|
|
|
|
|
|
|
|
|
|
template <class T> inline std::vector<T> MakeVector(const T a[], size_t s) {
|
|
|
|
|
return std::vector<T>(a, a + s);
|
|
|
|
|
}
|
2015-11-10 23:44:30 -08:00
|
|
|
#define MAKE_VECTOR(a) cricket::MakeVector(a, arraysize(a))
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
struct RtpDumpPacket;
|
|
|
|
|
class RtpDumpWriter;
|
|
|
|
|
class VideoFrame;
|
|
|
|
|
|
|
|
|
|
struct RawRtpPacket {
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
void WriteToByteBuffer(uint32_t in_ssrc, rtc::ByteBuffer* buf) const;
|
2014-07-29 17:36:52 +00:00
|
|
|
bool ReadFromByteBuffer(rtc::ByteBuffer* buf);
|
2013-07-10 00:45:36 +00:00
|
|
|
// Check if this packet is the same as the specified packet except the
|
|
|
|
|
// sequence number and timestamp, which should be the same as the specified
|
|
|
|
|
// parameters.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
bool SameExceptSeqNumTimestampSsrc(const RawRtpPacket& packet,
|
|
|
|
|
uint16_t seq,
|
|
|
|
|
uint32_t ts,
|
|
|
|
|
uint32_t ssc) const;
|
2013-07-10 00:45:36 +00:00
|
|
|
int size() const { return 28; }
|
|
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint8_t ver_to_cc;
|
|
|
|
|
uint8_t m_to_pt;
|
|
|
|
|
uint16_t sequence_number;
|
|
|
|
|
uint32_t timestamp;
|
|
|
|
|
uint32_t ssrc;
|
2013-07-10 00:45:36 +00:00
|
|
|
char payload[16];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct RawRtcpPacket {
|
2014-07-29 17:36:52 +00:00
|
|
|
void WriteToByteBuffer(rtc::ByteBuffer* buf) const;
|
|
|
|
|
bool ReadFromByteBuffer(rtc::ByteBuffer* buf);
|
2013-07-10 00:45:36 +00:00
|
|
|
bool EqualsTo(const RawRtcpPacket& packet) const;
|
|
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint8_t ver_to_count;
|
|
|
|
|
uint8_t type;
|
|
|
|
|
uint16_t length;
|
2013-07-10 00:45:36 +00:00
|
|
|
char payload[16];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class RtpTestUtility {
|
|
|
|
|
public:
|
|
|
|
|
static size_t GetTestPacketCount();
|
|
|
|
|
|
|
|
|
|
// Write the first count number of kTestRawRtcpPackets or kTestRawRtpPackets,
|
|
|
|
|
// depending on the flag rtcp. If it is RTP, use the specified SSRC. Return
|
|
|
|
|
// true if successful.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
static bool WriteTestPackets(size_t count,
|
|
|
|
|
bool rtcp,
|
|
|
|
|
uint32_t rtp_ssrc,
|
|
|
|
|
RtpDumpWriter* writer);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Loop read the first count number of packets from the specified stream.
|
|
|
|
|
// Verify the elapsed time of the dump packets increase monotonically. If the
|
|
|
|
|
// stream is a RTP stream, verify the RTP sequence number, timestamp, and
|
|
|
|
|
// payload. If the stream is a RTCP stream, verify the RTCP header and
|
|
|
|
|
// payload.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
static bool VerifyTestPacketsFromStream(size_t count,
|
|
|
|
|
rtc::StreamInterface* stream,
|
|
|
|
|
uint32_t ssrc);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Verify the dump packet is the same as the raw RTP packet.
|
|
|
|
|
static bool VerifyPacket(const RtpDumpPacket* dump,
|
|
|
|
|
const RawRtpPacket* raw,
|
|
|
|
|
bool header_only);
|
|
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
static const uint32_t kDefaultSsrc = 1;
|
|
|
|
|
static const uint32_t kRtpTimestampIncrease = 90;
|
|
|
|
|
static const uint32_t kDefaultTimeIncrease = 30;
|
|
|
|
|
static const uint32_t kElapsedTimeInterval = 10;
|
2013-07-10 00:45:36 +00:00
|
|
|
static const RawRtpPacket kTestRawRtpPackets[];
|
|
|
|
|
static const RawRtcpPacket kTestRawRtcpPackets[];
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
RtpTestUtility() {}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Test helper for testing VideoCapturer implementations.
|
|
|
|
|
class VideoCapturerListener : public sigslot::has_slots<> {
|
|
|
|
|
public:
|
|
|
|
|
explicit VideoCapturerListener(VideoCapturer* cap);
|
|
|
|
|
|
|
|
|
|
CaptureState last_capture_state() const { return last_capture_state_; }
|
|
|
|
|
int frame_count() const { return frame_count_; }
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t frame_fourcc() const { return frame_fourcc_; }
|
2013-07-10 00:45:36 +00:00
|
|
|
int frame_width() const { return frame_width_; }
|
|
|
|
|
int frame_height() const { return frame_height_; }
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t frame_size() const { return frame_size_; }
|
2013-07-10 00:45:36 +00:00
|
|
|
bool resolution_changed() const { return resolution_changed_; }
|
|
|
|
|
|
|
|
|
|
void OnStateChange(VideoCapturer* capturer, CaptureState state);
|
|
|
|
|
void OnFrameCaptured(VideoCapturer* capturer, const CapturedFrame* frame);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
CaptureState last_capture_state_;
|
|
|
|
|
int frame_count_;
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t frame_fourcc_;
|
2013-07-10 00:45:36 +00:00
|
|
|
int frame_width_;
|
|
|
|
|
int frame_height_;
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t frame_size_;
|
2013-07-10 00:45:36 +00:00
|
|
|
bool resolution_changed_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ScreencastEventCatcher : public sigslot::has_slots<> {
|
|
|
|
|
public:
|
2014-07-29 17:36:52 +00:00
|
|
|
ScreencastEventCatcher() : ssrc_(0), ev_(rtc::WE_RESIZE) { }
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t ssrc() const { return ssrc_; }
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::WindowEvent event() const { return ev_; }
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
void OnEvent(uint32_t ssrc, rtc::WindowEvent ev) {
|
2013-07-10 00:45:36 +00:00
|
|
|
ssrc_ = ssrc;
|
|
|
|
|
ev_ = ev;
|
|
|
|
|
}
|
|
|
|
|
private:
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t ssrc_;
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::WindowEvent ev_;
|
2013-07-10 00:45:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class VideoMediaErrorCatcher : public sigslot::has_slots<> {
|
|
|
|
|
public:
|
|
|
|
|
VideoMediaErrorCatcher() : ssrc_(0), error_(VideoMediaChannel::ERROR_NONE) { }
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t ssrc() const { return ssrc_; }
|
2013-07-10 00:45:36 +00:00
|
|
|
VideoMediaChannel::Error error() const { return error_; }
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
void OnError(uint32_t ssrc, VideoMediaChannel::Error error) {
|
2013-07-10 00:45:36 +00:00
|
|
|
ssrc_ = ssrc;
|
|
|
|
|
error_ = error;
|
|
|
|
|
}
|
|
|
|
|
private:
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
uint32_t ssrc_;
|
2013-07-10 00:45:36 +00:00
|
|
|
VideoMediaChannel::Error error_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Returns the absolute path to a file in the testdata/ directory.
|
|
|
|
|
std::string GetTestFilePath(const std::string& filename);
|
|
|
|
|
|
|
|
|
|
// PSNR formula: psnr = 10 * log10 (Peak Signal^2 / mse)
|
|
|
|
|
// sse is set to a small number for identical frames or sse == 0
|
|
|
|
|
static inline double ComputePSNR(double sse, double count) {
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
return libyuv::SumSquareErrorToPsnr(static_cast<uint64_t>(sse),
|
|
|
|
|
static_cast<uint64_t>(count));
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
static inline double ComputeSumSquareError(const uint8_t* org,
|
|
|
|
|
const uint8_t* rec,
|
2013-07-10 00:45:36 +00:00
|
|
|
int size) {
|
|
|
|
|
return static_cast<double>(libyuv::ComputeSumSquareError(org, rec, size));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Loads the image with the specified prefix and size into |out|.
|
|
|
|
|
bool LoadPlanarYuvTestImage(const std::string& prefix,
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
uint8_t* out);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Dumps the YUV image out to a file, for visual inspection.
|
|
|
|
|
// PYUV tool can be used to view dump files.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
void DumpPlanarYuvTestImage(const std::string& prefix,
|
|
|
|
|
const uint8_t* img,
|
|
|
|
|
int w,
|
|
|
|
|
int h);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Dumps the ARGB image out to a file, for visual inspection.
|
|
|
|
|
// ffplay tool can be used to view dump files.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
void DumpPlanarArgbTestImage(const std::string& prefix,
|
|
|
|
|
const uint8_t* img,
|
|
|
|
|
int w,
|
|
|
|
|
int h);
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// Compare two I420 frames.
|
|
|
|
|
bool VideoFrameEqual(const VideoFrame* frame0, const VideoFrame* frame1);
|
|
|
|
|
|
|
|
|
|
// Checks whether |codecs| contains |codec|; checks using Codec::Matches().
|
|
|
|
|
template <class C>
|
|
|
|
|
bool ContainsMatchingCodec(const std::vector<C>& codecs, const C& codec) {
|
|
|
|
|
typename std::vector<C>::const_iterator it;
|
|
|
|
|
for (it = codecs.begin(); it != codecs.end(); ++it) {
|
|
|
|
|
if (it->Matches(codec)) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-12-05 00:24:06 +00:00
|
|
|
|
|
|
|
|
// Create Simulcast StreamParams with given |ssrcs| and |cname|.
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
cricket::StreamParams CreateSimStreamParams(const std::string& cname,
|
|
|
|
|
const std::vector<uint32_t>& ssrcs);
|
2013-12-05 00:24:06 +00:00
|
|
|
// Create Simulcast stream with given |ssrcs| and |rtx_ssrcs|.
|
|
|
|
|
// The number of |rtx_ssrcs| must match number of |ssrcs|.
|
|
|
|
|
cricket::StreamParams CreateSimWithRtxStreamParams(
|
Use suffixed {uint,int}{8,16,32,64}_t types.
Removes the use of uint8, etc. in favor of uint8_t.
BUG=webrtc:5024
R=henrik.lundin@webrtc.org, henrikg@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1362503003 .
Cr-Commit-Position: refs/heads/master@{#10196}
2015-10-07 12:23:21 +02:00
|
|
|
const std::string& cname,
|
|
|
|
|
const std::vector<uint32_t>& ssrcs,
|
|
|
|
|
const std::vector<uint32_t>& rtx_ssrcs);
|
2013-12-05 00:24:06 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace cricket
|
|
|
|
|
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#endif // WEBRTC_MEDIA_BASE_TESTUTILS_H_
|