2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Copyright (c) 2004 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-07 20:46:45 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
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/testutils.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
#include <math.h>
|
2015-02-12 11:54:26 +00:00
|
|
|
#include <algorithm>
|
2016-02-26 03:00:35 -08:00
|
|
|
#include <memory>
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
#include "webrtc/base/bytebuffer.h"
|
|
|
|
|
#include "webrtc/base/fileutils.h"
|
|
|
|
|
#include "webrtc/base/gunit.h"
|
|
|
|
|
#include "webrtc/base/pathutils.h"
|
|
|
|
|
#include "webrtc/base/stream.h"
|
|
|
|
|
#include "webrtc/base/stringutils.h"
|
|
|
|
|
#include "webrtc/base/testutils.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/rtpdump.h"
|
|
|
|
|
#include "webrtc/media/base/videocapturer.h"
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
#include "webrtc/video_frame.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace cricket {
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Implementation of 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 RawRtpPacket::WriteToByteBuffer(uint32_t in_ssrc,
|
2016-03-30 06:43:37 -07:00
|
|
|
rtc::ByteBufferWriter* buf) const {
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!buf) return;
|
|
|
|
|
|
|
|
|
|
buf->WriteUInt8(ver_to_cc);
|
|
|
|
|
buf->WriteUInt8(m_to_pt);
|
|
|
|
|
buf->WriteUInt16(sequence_number);
|
|
|
|
|
buf->WriteUInt32(timestamp);
|
|
|
|
|
buf->WriteUInt32(in_ssrc);
|
|
|
|
|
buf->WriteBytes(payload, sizeof(payload));
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-30 06:43:37 -07:00
|
|
|
bool RawRtpPacket::ReadFromByteBuffer(rtc::ByteBufferReader* buf) {
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!buf) return false;
|
|
|
|
|
|
|
|
|
|
bool ret = true;
|
|
|
|
|
ret &= buf->ReadUInt8(&ver_to_cc);
|
|
|
|
|
ret &= buf->ReadUInt8(&m_to_pt);
|
|
|
|
|
ret &= buf->ReadUInt16(&sequence_number);
|
|
|
|
|
ret &= buf->ReadUInt32(×tamp);
|
|
|
|
|
ret &= buf->ReadUInt32(&ssrc);
|
|
|
|
|
ret &= buf->ReadBytes(payload, sizeof(payload));
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
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 RawRtpPacket::SameExceptSeqNumTimestampSsrc(const RawRtpPacket& packet,
|
|
|
|
|
uint16_t seq,
|
|
|
|
|
uint32_t ts,
|
|
|
|
|
uint32_t ssc) const {
|
2013-07-10 00:45:36 +00:00
|
|
|
return sequence_number == seq &&
|
|
|
|
|
timestamp == ts &&
|
|
|
|
|
ver_to_cc == packet.ver_to_cc &&
|
|
|
|
|
m_to_pt == packet.m_to_pt &&
|
|
|
|
|
ssrc == ssc &&
|
|
|
|
|
0 == memcmp(payload, packet.payload, sizeof(payload));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Implementation of RawRtcpPacket
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2016-03-30 06:43:37 -07:00
|
|
|
void RawRtcpPacket::WriteToByteBuffer(rtc::ByteBufferWriter *buf) const {
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!buf) return;
|
|
|
|
|
|
|
|
|
|
buf->WriteUInt8(ver_to_count);
|
|
|
|
|
buf->WriteUInt8(type);
|
|
|
|
|
buf->WriteUInt16(length);
|
|
|
|
|
buf->WriteBytes(payload, sizeof(payload));
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-30 06:43:37 -07:00
|
|
|
bool RawRtcpPacket::ReadFromByteBuffer(rtc::ByteBufferReader* buf) {
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!buf) return false;
|
|
|
|
|
|
|
|
|
|
bool ret = true;
|
|
|
|
|
ret &= buf->ReadUInt8(&ver_to_count);
|
|
|
|
|
ret &= buf->ReadUInt8(&type);
|
|
|
|
|
ret &= buf->ReadUInt16(&length);
|
|
|
|
|
ret &= buf->ReadBytes(payload, sizeof(payload));
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RawRtcpPacket::EqualsTo(const RawRtcpPacket& packet) const {
|
|
|
|
|
return ver_to_count == packet.ver_to_count &&
|
|
|
|
|
type == packet.type &&
|
|
|
|
|
length == packet.length &&
|
|
|
|
|
0 == memcmp(payload, packet.payload, sizeof(payload));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Implementation of class RtpTestUtility
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
const RawRtpPacket RtpTestUtility::kTestRawRtpPackets[] = {
|
|
|
|
|
{0x80, 0, 0, 0, RtpTestUtility::kDefaultSsrc, "RTP frame 0"},
|
|
|
|
|
{0x80, 0, 1, 30, RtpTestUtility::kDefaultSsrc, "RTP frame 1"},
|
|
|
|
|
{0x80, 0, 2, 30, RtpTestUtility::kDefaultSsrc, "RTP frame 1"},
|
|
|
|
|
{0x80, 0, 3, 60, RtpTestUtility::kDefaultSsrc, "RTP frame 2"}
|
|
|
|
|
};
|
|
|
|
|
const RawRtcpPacket RtpTestUtility::kTestRawRtcpPackets[] = {
|
|
|
|
|
// The Version is 2, the Length is 2, and the payload has 8 bytes.
|
|
|
|
|
{0x80, 0, 2, "RTCP0000"},
|
|
|
|
|
{0x80, 0, 2, "RTCP0001"},
|
|
|
|
|
{0x80, 0, 2, "RTCP0002"},
|
|
|
|
|
{0x80, 0, 2, "RTCP0003"},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
size_t RtpTestUtility::GetTestPacketCount() {
|
2015-11-10 23:44:30 -08:00
|
|
|
return std::min(arraysize(kTestRawRtpPackets),
|
|
|
|
|
arraysize(kTestRawRtcpPackets));
|
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
|
|
|
bool RtpTestUtility::WriteTestPackets(size_t count,
|
|
|
|
|
bool rtcp,
|
|
|
|
|
uint32_t rtp_ssrc,
|
|
|
|
|
RtpDumpWriter* writer) {
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!writer || count > GetTestPacketCount()) return false;
|
|
|
|
|
|
|
|
|
|
bool result = true;
|
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 elapsed_time_ms = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
for (size_t i = 0; i < count && result; ++i) {
|
2016-03-30 06:43:37 -07:00
|
|
|
rtc::ByteBufferWriter buf;
|
2013-07-10 00:45:36 +00:00
|
|
|
if (rtcp) {
|
|
|
|
|
kTestRawRtcpPackets[i].WriteToByteBuffer(&buf);
|
|
|
|
|
} else {
|
|
|
|
|
kTestRawRtpPackets[i].WriteToByteBuffer(rtp_ssrc, &buf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RtpDumpPacket dump_packet(buf.Data(), buf.Length(), elapsed_time_ms, rtcp);
|
|
|
|
|
elapsed_time_ms += kElapsedTimeInterval;
|
2014-07-29 17:36:52 +00:00
|
|
|
result &= (rtc::SR_SUCCESS == writer->WritePacket(dump_packet));
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
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 RtpTestUtility::VerifyTestPacketsFromStream(size_t count,
|
|
|
|
|
rtc::StreamInterface* stream,
|
|
|
|
|
uint32_t ssrc) {
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!stream) return false;
|
|
|
|
|
|
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 prev_elapsed_time = 0;
|
2013-07-10 00:45:36 +00:00
|
|
|
bool result = true;
|
|
|
|
|
stream->Rewind();
|
|
|
|
|
RtpDumpLoopReader reader(stream);
|
|
|
|
|
for (size_t i = 0; i < count && result; ++i) {
|
|
|
|
|
// Which loop and which index in the loop are we reading now.
|
|
|
|
|
size_t loop = i / GetTestPacketCount();
|
|
|
|
|
size_t index = i % GetTestPacketCount();
|
|
|
|
|
|
|
|
|
|
RtpDumpPacket packet;
|
2014-07-29 17:36:52 +00:00
|
|
|
result &= (rtc::SR_SUCCESS == reader.ReadPacket(&packet));
|
2013-07-10 00:45:36 +00:00
|
|
|
// Check the elapsed time of the dump packet.
|
|
|
|
|
result &= (packet.elapsed_time >= prev_elapsed_time);
|
|
|
|
|
prev_elapsed_time = packet.elapsed_time;
|
|
|
|
|
|
|
|
|
|
// Check the RTP or RTCP packet.
|
2016-03-30 06:43:37 -07:00
|
|
|
rtc::ByteBufferReader buf(reinterpret_cast<const char*>(&packet.data[0]),
|
2013-07-10 00:45:36 +00:00
|
|
|
packet.data.size());
|
|
|
|
|
if (packet.is_rtcp()) {
|
|
|
|
|
// RTCP packet.
|
|
|
|
|
RawRtcpPacket rtcp_packet;
|
|
|
|
|
result &= rtcp_packet.ReadFromByteBuffer(&buf);
|
|
|
|
|
result &= rtcp_packet.EqualsTo(kTestRawRtcpPackets[index]);
|
|
|
|
|
} else {
|
|
|
|
|
// RTP packet.
|
|
|
|
|
RawRtpPacket rtp_packet;
|
|
|
|
|
result &= rtp_packet.ReadFromByteBuffer(&buf);
|
|
|
|
|
result &= rtp_packet.SameExceptSeqNumTimestampSsrc(
|
|
|
|
|
kTestRawRtpPackets[index],
|
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_cast<uint16_t>(kTestRawRtpPackets[index].sequence_number +
|
|
|
|
|
loop * GetTestPacketCount()),
|
|
|
|
|
static_cast<uint32_t>(kTestRawRtpPackets[index].timestamp +
|
|
|
|
|
loop * kRtpTimestampIncrease),
|
2013-07-10 00:45:36 +00:00
|
|
|
ssrc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stream->Rewind();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RtpTestUtility::VerifyPacket(const RtpDumpPacket* dump,
|
|
|
|
|
const RawRtpPacket* raw,
|
|
|
|
|
bool header_only) {
|
|
|
|
|
if (!dump || !raw) return false;
|
|
|
|
|
|
2016-03-30 06:43:37 -07:00
|
|
|
rtc::ByteBufferWriter buf;
|
2013-07-10 00:45:36 +00:00
|
|
|
raw->WriteToByteBuffer(RtpTestUtility::kDefaultSsrc, &buf);
|
|
|
|
|
|
|
|
|
|
if (header_only) {
|
|
|
|
|
size_t header_len = 0;
|
|
|
|
|
dump->GetRtpHeaderLen(&header_len);
|
|
|
|
|
return header_len == dump->data.size() &&
|
|
|
|
|
buf.Length() > dump->data.size() &&
|
|
|
|
|
0 == memcmp(buf.Data(), &dump->data[0], dump->data.size());
|
|
|
|
|
} else {
|
|
|
|
|
return buf.Length() == dump->data.size() &&
|
|
|
|
|
0 == memcmp(buf.Data(), &dump->data[0], dump->data.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Implementation of VideoCaptureListener.
|
|
|
|
|
VideoCapturerListener::VideoCapturerListener(VideoCapturer* capturer)
|
2016-08-23 05:50:09 -07:00
|
|
|
: capturer_(capturer),
|
|
|
|
|
last_capture_state_(CS_STARTING),
|
2013-07-10 00:45:36 +00:00
|
|
|
frame_count_(0),
|
|
|
|
|
frame_width_(0),
|
|
|
|
|
frame_height_(0),
|
|
|
|
|
resolution_changed_(false) {
|
|
|
|
|
capturer->SignalStateChange.connect(this,
|
|
|
|
|
&VideoCapturerListener::OnStateChange);
|
2016-08-23 05:50:09 -07:00
|
|
|
capturer->AddOrUpdateSink(this, rtc::VideoSinkWants());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
VideoCapturerListener::~VideoCapturerListener() {
|
|
|
|
|
capturer_->RemoveSink(this);
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void VideoCapturerListener::OnStateChange(VideoCapturer* capturer,
|
|
|
|
|
CaptureState result) {
|
|
|
|
|
last_capture_state_ = result;
|
|
|
|
|
}
|
|
|
|
|
|
Reland of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #1 id:1 of https://codereview.webrtc.org/2471783002/ )
Reason for revert:
Relanding after known downstream breakages have been fixed.
Original issue's description:
> Revert of Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame. (patchset #7 id:120001 of https://codereview.webrtc.org/2383093002/ )
>
> Reason for revert:
> Breaks chrome, see https://build.chromium.org/p/chromium.webrtc.fyi/builders/Mac%20Builder/builds/19019/steps/compile/logs/stdio
>
> Analysis: Chrome uses cricket::VideoFrame, without explicitly including webrtc/media/base/videoframe.h, and breaks when that file is no longer included by any other webrtc headers. Will reland after updating Chrome.
>
> Original issue's description:
> > Delete all use of cricket::VideoFrame and cricket::WebRtcVideoFrame.
> >
> > Replaced with webrtc::VideoFrame.
> >
> > TBR=mflodman@webrtc.org
> > BUG=webrtc:5682
> >
> > Committed: https://crrev.com/45c8b8940042bd2574c39920804ade8343cefdba
> > Cr-Commit-Position: refs/heads/master@{#14885}
>
> TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:5682
>
> Committed: https://crrev.com/7341ab8e2505c9763d208e069bda269018357e7d
> Cr-Commit-Position: refs/heads/master@{#14886}
TBR=perkj@webrtc.org,pthatcher@webrtc.org,tkchin@webrtc.org,mflodman@webrtc.org,stefan@webrtc.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=webrtc:5682
Review-Url: https://codereview.webrtc.org/2487633002
Cr-Commit-Position: refs/heads/master@{#15039}
2016-11-11 03:55:13 -08:00
|
|
|
void VideoCapturerListener::OnFrame(const webrtc::VideoFrame& frame) {
|
2013-07-10 00:45:36 +00:00
|
|
|
++frame_count_;
|
|
|
|
|
if (1 == frame_count_) {
|
2016-08-23 05:50:09 -07:00
|
|
|
frame_width_ = frame.width();
|
|
|
|
|
frame_height_ = frame.height();
|
|
|
|
|
} else if (frame_width_ != frame.width() || frame_height_ != frame.height()) {
|
2013-07-10 00:45:36 +00:00
|
|
|
resolution_changed_ = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-05 00:24:06 +00:00
|
|
|
cricket::StreamParams CreateSimStreamParams(
|
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) {
|
2013-12-05 00:24:06 +00:00
|
|
|
cricket::StreamParams sp;
|
|
|
|
|
cricket::SsrcGroup sg(cricket::kSimSsrcGroupSemantics, ssrcs);
|
|
|
|
|
sp.ssrcs = ssrcs;
|
|
|
|
|
sp.ssrc_groups.push_back(sg);
|
|
|
|
|
sp.cname = cname;
|
|
|
|
|
return sp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// There should be an rtx_ssrc per ssrc.
|
|
|
|
|
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
|
|
|
cricket::StreamParams sp = CreateSimStreamParams(cname, ssrcs);
|
|
|
|
|
for (size_t i = 0; i < ssrcs.size(); ++i) {
|
|
|
|
|
sp.ssrcs.push_back(rtx_ssrcs[i]);
|
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
|
|
|
std::vector<uint32_t> fid_ssrcs;
|
2013-12-05 00:24:06 +00:00
|
|
|
fid_ssrcs.push_back(ssrcs[i]);
|
|
|
|
|
fid_ssrcs.push_back(rtx_ssrcs[i]);
|
|
|
|
|
cricket::SsrcGroup fid_group(cricket::kFidSsrcGroupSemantics, fid_ssrcs);
|
|
|
|
|
sp.ssrc_groups.push_back(fid_group);
|
|
|
|
|
}
|
|
|
|
|
return sp;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace cricket
|