2014-08-06 16:26:56 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
#include <map>
|
2016-03-01 11:52:33 -08:00
|
|
|
#include <memory>
|
2014-08-06 16:26:56 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "api/video_codecs/video_decoder.h"
|
|
|
|
|
#include "call/call.h"
|
|
|
|
|
#include "common_video/libyuv/include/webrtc_libyuv.h"
|
|
|
|
|
#include "logging/rtc_event_log/rtc_event_log.h"
|
|
|
|
|
#include "modules/rtp_rtcp/include/rtp_header_parser.h"
|
|
|
|
|
#include "rtc_base/checks.h"
|
|
|
|
|
#include "rtc_base/flags.h"
|
|
|
|
|
#include "rtc_base/string_to_number.h"
|
|
|
|
|
#include "system_wrappers/include/clock.h"
|
|
|
|
|
#include "system_wrappers/include/sleep.h"
|
|
|
|
|
#include "test/call_test.h"
|
|
|
|
|
#include "test/encoder_settings.h"
|
|
|
|
|
#include "test/fake_decoder.h"
|
|
|
|
|
#include "test/gtest.h"
|
|
|
|
|
#include "test/null_transport.h"
|
|
|
|
|
#include "test/rtp_file_reader.h"
|
|
|
|
|
#include "test/run_loop.h"
|
|
|
|
|
#include "test/run_test.h"
|
|
|
|
|
#include "test/testsupport/frame_writer.h"
|
|
|
|
|
#include "test/video_capturer.h"
|
|
|
|
|
#include "test/video_renderer.h"
|
2017-09-15 13:58:09 +02:00
|
|
|
#include "typedefs.h" // NOLINT(build/include)
|
2014-08-06 16:26:56 +00:00
|
|
|
|
2017-08-31 03:21:39 -07:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
static bool ValidatePayloadType(int32_t payload_type) {
|
|
|
|
|
return payload_type > 0 && payload_type <= 127;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool ValidateSsrc(const char* ssrc_string) {
|
|
|
|
|
return rtc::StringToNumber<uint32_t>(ssrc_string).has_value();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool ValidateOptionalPayloadType(int32_t payload_type) {
|
|
|
|
|
return payload_type == -1 || ValidatePayloadType(payload_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool ValidateRtpHeaderExtensionId(int32_t extension_id) {
|
|
|
|
|
return extension_id >= -1 && extension_id < 15;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool ValidateInputFilenameNotEmpty(const std::string& string) {
|
|
|
|
|
return !string.empty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
2014-08-06 16:26:56 +00:00
|
|
|
namespace webrtc {
|
|
|
|
|
namespace flags {
|
|
|
|
|
|
|
|
|
|
// TODO(pbos): Multiple receivers.
|
|
|
|
|
|
|
|
|
|
// Flag for payload type.
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_int(payload_type, test::CallTest::kPayloadTypeVP8, "Payload type");
|
|
|
|
|
static int PayloadType() { return static_cast<int>(FLAG_payload_type); }
|
|
|
|
|
|
|
|
|
|
DEFINE_int(payload_type_rtx,
|
|
|
|
|
test::CallTest::kSendRtxPayloadType,
|
|
|
|
|
"RTX payload type");
|
2017-07-11 02:38:36 -07:00
|
|
|
static int PayloadTypeRtx() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<int>(FLAG_payload_type_rtx);
|
2017-07-11 02:38:36 -07:00
|
|
|
}
|
|
|
|
|
|
2014-08-06 16:26:56 +00:00
|
|
|
// Flag for SSRC.
|
2017-08-31 03:21:39 -07:00
|
|
|
const std::string& DefaultSsrc() {
|
|
|
|
|
static const std::string ssrc = std::to_string(
|
|
|
|
|
test::CallTest::kVideoSendSsrcs[0]);
|
|
|
|
|
return ssrc;
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_string(ssrc, DefaultSsrc().c_str(), "Incoming SSRC");
|
|
|
|
|
static uint32_t Ssrc() {
|
|
|
|
|
return rtc::StringToNumber<uint32_t>(FLAG_ssrc).value();
|
2017-07-11 02:38:36 -07:00
|
|
|
}
|
|
|
|
|
|
2017-08-31 03:21:39 -07:00
|
|
|
const std::string& DefaultSsrcRtx() {
|
|
|
|
|
static const std::string ssrc_rtx = std::to_string(
|
|
|
|
|
test::CallTest::kSendRtxSsrcs[0]);
|
|
|
|
|
return ssrc_rtx;
|
|
|
|
|
}
|
|
|
|
|
DEFINE_string(ssrc_rtx, DefaultSsrcRtx().c_str(), "Incoming RTX SSRC");
|
|
|
|
|
static uint32_t SsrcRtx() {
|
|
|
|
|
return rtc::StringToNumber<uint32_t>(FLAG_ssrc_rtx).value();
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Flag for RED payload type.
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_int(red_payload_type, -1, "RED payload type");
|
2014-08-06 16:26:56 +00:00
|
|
|
static int RedPayloadType() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<int>(FLAG_red_payload_type);
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Flag for ULPFEC payload type.
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_int(fec_payload_type, -1, "ULPFEC payload type");
|
2014-08-06 16:26:56 +00:00
|
|
|
static int FecPayloadType() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<int>(FLAG_fec_payload_type);
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Flag for abs-send-time id.
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_int(abs_send_time_id, -1, "RTP extension ID for abs-send-time");
|
|
|
|
|
static int AbsSendTimeId() { return static_cast<int>(FLAG_abs_send_time_id); }
|
2014-08-06 16:26:56 +00:00
|
|
|
|
|
|
|
|
// Flag for transmission-offset id.
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_int(transmission_offset_id,
|
|
|
|
|
-1,
|
|
|
|
|
"RTP extension ID for transmission-offset");
|
2014-08-06 16:26:56 +00:00
|
|
|
static int TransmissionOffsetId() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<int>(FLAG_transmission_offset_id);
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Flag for rtpdump input file.
|
2014-08-07 14:42:45 +00:00
|
|
|
DEFINE_string(input_file, "", "input file");
|
2014-08-06 16:26:56 +00:00
|
|
|
static std::string InputFile() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<std::string>(FLAG_input_file);
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Flag for raw output files.
|
2017-08-25 07:24:21 -07:00
|
|
|
DEFINE_string(out_base, "", "Basename (excluding .jpg) for raw output");
|
2014-08-06 16:26:56 +00:00
|
|
|
static std::string OutBase() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<std::string>(FLAG_out_base);
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
2015-03-02 16:18:56 +00:00
|
|
|
DEFINE_string(decoder_bitstream_filename, "", "Decoder bitstream output file");
|
|
|
|
|
static std::string DecoderBitstreamFilename() {
|
2017-08-31 03:21:39 -07:00
|
|
|
return static_cast<std::string>(FLAG_decoder_bitstream_filename);
|
2015-03-02 16:18:56 +00:00
|
|
|
}
|
|
|
|
|
|
2014-08-06 16:26:56 +00:00
|
|
|
// Flag for video codec.
|
2014-08-07 14:42:45 +00:00
|
|
|
DEFINE_string(codec, "VP8", "Video codec");
|
2017-08-31 03:21:39 -07:00
|
|
|
static std::string Codec() { return static_cast<std::string>(FLAG_codec); }
|
2014-08-06 16:26:56 +00:00
|
|
|
|
2017-08-31 03:21:39 -07:00
|
|
|
DEFINE_bool(help, false, "Print this message.");
|
2014-08-06 16:26:56 +00:00
|
|
|
} // namespace flags
|
|
|
|
|
|
|
|
|
|
static const uint32_t kReceiverLocalSsrc = 0x123456;
|
|
|
|
|
|
2016-03-23 04:48:10 -07:00
|
|
|
class FileRenderPassthrough : public rtc::VideoSinkInterface<VideoFrame> {
|
2014-08-06 16:26:56 +00:00
|
|
|
public:
|
2016-03-23 04:48:10 -07:00
|
|
|
FileRenderPassthrough(const std::string& basename,
|
|
|
|
|
rtc::VideoSinkInterface<VideoFrame>* renderer)
|
2017-08-25 07:24:21 -07:00
|
|
|
: basename_(basename), renderer_(renderer), file_(nullptr), count_(0) {}
|
2014-08-06 16:26:56 +00:00
|
|
|
|
|
|
|
|
~FileRenderPassthrough() {
|
2016-04-04 17:56:10 +02:00
|
|
|
if (file_)
|
2014-08-06 16:26:56 +00:00
|
|
|
fclose(file_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2016-03-21 01:27:56 -07:00
|
|
|
void OnFrame(const VideoFrame& video_frame) override {
|
2016-04-04 17:56:10 +02:00
|
|
|
if (renderer_)
|
2016-03-21 01:27:56 -07:00
|
|
|
renderer_->OnFrame(video_frame);
|
2017-08-25 07:24:21 -07:00
|
|
|
|
2015-07-09 07:48:14 -07:00
|
|
|
if (basename_.empty())
|
2014-08-06 16:26:56 +00:00
|
|
|
return;
|
2017-08-25 07:24:21 -07:00
|
|
|
|
|
|
|
|
std::stringstream filename;
|
|
|
|
|
filename << basename_ << count_++ << "_" << video_frame.timestamp()
|
|
|
|
|
<< ".jpg";
|
|
|
|
|
|
|
|
|
|
test::JpegFrameWriter frame_writer(filename.str());
|
|
|
|
|
RTC_CHECK(frame_writer.WriteFrame(video_frame, 100));
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const std::string basename_;
|
2016-03-23 04:48:10 -07:00
|
|
|
rtc::VideoSinkInterface<VideoFrame>* const renderer_;
|
2014-08-06 16:26:56 +00:00
|
|
|
FILE* file_;
|
|
|
|
|
size_t count_;
|
|
|
|
|
};
|
|
|
|
|
|
2015-03-02 16:18:56 +00:00
|
|
|
class DecoderBitstreamFileWriter : public EncodedFrameObserver {
|
|
|
|
|
public:
|
|
|
|
|
explicit DecoderBitstreamFileWriter(const char* filename)
|
|
|
|
|
: file_(fopen(filename, "wb")) {
|
2016-04-04 17:56:10 +02:00
|
|
|
RTC_DCHECK(file_);
|
2015-03-02 16:18:56 +00:00
|
|
|
}
|
|
|
|
|
~DecoderBitstreamFileWriter() { fclose(file_); }
|
|
|
|
|
|
|
|
|
|
virtual void EncodedFrameCallback(const EncodedFrame& encoded_frame) {
|
|
|
|
|
fwrite(encoded_frame.data_, 1, encoded_frame.length_, file_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
FILE* file_;
|
|
|
|
|
};
|
|
|
|
|
|
2014-08-06 16:26:56 +00:00
|
|
|
void RtpReplay() {
|
2017-09-06 07:14:02 -07:00
|
|
|
std::stringstream window_title;
|
|
|
|
|
window_title << "Playback Video (" << flags::InputFile() << ")";
|
2016-03-01 11:52:33 -08:00
|
|
|
std::unique_ptr<test::VideoRenderer> playback_video(
|
2017-09-06 07:14:02 -07:00
|
|
|
test::VideoRenderer::Create(window_title.str().c_str(), 640, 480));
|
2014-08-06 16:26:56 +00:00
|
|
|
FileRenderPassthrough file_passthrough(flags::OutBase(),
|
|
|
|
|
playback_video.get());
|
|
|
|
|
|
2016-12-20 07:26:58 -08:00
|
|
|
webrtc::RtcEventLogNullImpl event_log;
|
|
|
|
|
std::unique_ptr<Call> call(Call::Create(Call::Config(&event_log)));
|
2014-08-06 16:26:56 +00:00
|
|
|
|
2015-08-28 04:07:10 -07:00
|
|
|
test::NullTransport transport;
|
|
|
|
|
VideoReceiveStream::Config receive_config(&transport);
|
2014-08-06 16:26:56 +00:00
|
|
|
receive_config.rtp.remote_ssrc = flags::Ssrc();
|
|
|
|
|
receive_config.rtp.local_ssrc = kReceiverLocalSsrc;
|
2017-07-11 02:38:36 -07:00
|
|
|
receive_config.rtp.rtx_ssrc = flags::SsrcRtx();
|
2017-08-25 04:44:25 -07:00
|
|
|
receive_config.rtp.rtx_associated_payload_types[flags::PayloadTypeRtx()] =
|
|
|
|
|
flags::PayloadType();
|
2017-09-26 02:49:21 -07:00
|
|
|
receive_config.rtp.ulpfec_payload_type = flags::FecPayloadType();
|
|
|
|
|
receive_config.rtp.red_payload_type = flags::RedPayloadType();
|
2014-08-06 16:26:56 +00:00
|
|
|
receive_config.rtp.nack.rtp_history_ms = 1000;
|
|
|
|
|
if (flags::TransmissionOffsetId() != -1) {
|
2016-05-26 11:24:55 -07:00
|
|
|
receive_config.rtp.extensions.push_back(RtpExtension(
|
|
|
|
|
RtpExtension::kTimestampOffsetUri, flags::TransmissionOffsetId()));
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
if (flags::AbsSendTimeId() != -1) {
|
|
|
|
|
receive_config.rtp.extensions.push_back(
|
2016-05-26 11:24:55 -07:00
|
|
|
RtpExtension(RtpExtension::kAbsSendTimeUri, flags::AbsSendTimeId()));
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
receive_config.renderer = &file_passthrough;
|
|
|
|
|
|
|
|
|
|
VideoSendStream::Config::EncoderSettings encoder_settings;
|
|
|
|
|
encoder_settings.payload_name = flags::Codec();
|
|
|
|
|
encoder_settings.payload_type = flags::PayloadType();
|
2015-03-02 16:18:56 +00:00
|
|
|
VideoReceiveStream::Decoder decoder;
|
2016-03-01 11:52:33 -08:00
|
|
|
std::unique_ptr<DecoderBitstreamFileWriter> bitstream_writer;
|
2015-07-09 07:48:14 -07:00
|
|
|
if (!flags::DecoderBitstreamFilename().empty()) {
|
2015-03-02 16:18:56 +00:00
|
|
|
bitstream_writer.reset(new DecoderBitstreamFileWriter(
|
|
|
|
|
flags::DecoderBitstreamFilename().c_str()));
|
|
|
|
|
receive_config.pre_decode_callback = bitstream_writer.get();
|
|
|
|
|
}
|
|
|
|
|
decoder = test::CreateMatchingDecoder(encoder_settings);
|
2015-07-09 07:48:14 -07:00
|
|
|
if (!flags::DecoderBitstreamFilename().empty()) {
|
2015-03-02 16:18:56 +00:00
|
|
|
// Replace with a null decoder if we're writing the bitstream to a file
|
|
|
|
|
// instead.
|
|
|
|
|
delete decoder.decoder;
|
|
|
|
|
decoder.decoder = new test::FakeNullDecoder();
|
|
|
|
|
}
|
2014-10-29 15:28:39 +00:00
|
|
|
receive_config.decoders.push_back(decoder);
|
2014-08-06 16:26:56 +00:00
|
|
|
|
|
|
|
|
VideoReceiveStream* receive_stream =
|
2016-06-10 17:58:01 +02:00
|
|
|
call->CreateVideoReceiveStream(std::move(receive_config));
|
2014-08-06 16:26:56 +00:00
|
|
|
|
2016-03-01 11:52:33 -08:00
|
|
|
std::unique_ptr<test::RtpFileReader> rtp_reader(test::RtpFileReader::Create(
|
2014-08-06 16:26:56 +00:00
|
|
|
test::RtpFileReader::kRtpDump, flags::InputFile()));
|
2016-04-04 17:56:10 +02:00
|
|
|
if (!rtp_reader) {
|
2014-08-06 16:26:56 +00:00
|
|
|
rtp_reader.reset(test::RtpFileReader::Create(test::RtpFileReader::kPcap,
|
|
|
|
|
flags::InputFile()));
|
2016-04-04 17:56:10 +02:00
|
|
|
if (!rtp_reader) {
|
2014-08-06 16:26:56 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
|
"Couldn't open input file as either a rtpdump or .pcap. Note "
|
2015-03-02 16:18:56 +00:00
|
|
|
"that .pcapng is not supported.\nTrying to interpret the file as "
|
|
|
|
|
"length/packet interleaved.\n");
|
|
|
|
|
rtp_reader.reset(test::RtpFileReader::Create(
|
|
|
|
|
test::RtpFileReader::kLengthPacketInterleaved, flags::InputFile()));
|
2016-04-04 17:56:10 +02:00
|
|
|
if (!rtp_reader) {
|
2015-03-02 16:18:56 +00:00
|
|
|
fprintf(stderr,
|
|
|
|
|
"Unable to open input file with any supported format\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
receive_stream->Start();
|
|
|
|
|
|
|
|
|
|
uint32_t last_time_ms = 0;
|
|
|
|
|
int num_packets = 0;
|
2014-08-07 14:42:45 +00:00
|
|
|
std::map<uint32_t, int> unknown_packets;
|
2014-08-06 16:26:56 +00:00
|
|
|
while (true) {
|
2014-11-26 15:50:30 +00:00
|
|
|
test::RtpPacket packet;
|
2014-08-06 16:26:56 +00:00
|
|
|
if (!rtp_reader->NextPacket(&packet))
|
|
|
|
|
break;
|
|
|
|
|
++num_packets;
|
Reland of Don't hardcode MediaType::ANY in FakeNetworkPipe. (patchset #1 id:1 of https://codereview.webrtc.org/2784543002/ )
Reason for revert:
Intend to fix perf failures and reland.
Original issue's description:
> Revert of Don't hardcode MediaType::ANY in FakeNetworkPipe. (patchset #4 id:60001 of https://codereview.webrtc.org/2774463003/ )
>
> Reason for revert:
> Reverting since this seems to break multiple WebRTC Perf buildbots
>
> Original issue's description:
> > Don't hardcode MediaType::ANY in FakeNetworkPipe.
> >
> > Instead let each test set the appropriate media type. This simplifies
> > demuxing in Call and later in RtpTransportController.
> >
> > BUG=webrtc:7135
> >
> > Review-Url: https://codereview.webrtc.org/2774463003
> > Cr-Commit-Position: refs/heads/master@{#17418}
> > Committed: https://chromium.googlesource.com/external/webrtc/+/9c47b00e24da2941eb095df5a4459c6d98a8a88d
>
> TBR=stefan@webrtc.org,deadbeef@webrtc.org,solenberg@webrtc.org,pbos@webrtc.org,sprang@webrtc.org,nisse@webrtc.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=webrtc:7135
>
> Review-Url: https://codereview.webrtc.org/2784543002
> Cr-Commit-Position: refs/heads/master@{#17427}
> Committed: https://chromium.googlesource.com/external/webrtc/+/3a3bd5061089da5327fc549337a8430054d66057
TBR=stefan@webrtc.org,deadbeef@webrtc.org,solenberg@webrtc.org,pbos@webrtc.org,sprang@webrtc.org,lliuu@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:7135
Review-Url: https://codereview.webrtc.org/2783853002
Cr-Commit-Position: refs/heads/master@{#17459}
2017-03-29 23:57:43 -07:00
|
|
|
switch (call->Receiver()->DeliverPacket(
|
|
|
|
|
webrtc::MediaType::VIDEO, packet.data, packet.length, PacketTime())) {
|
2014-08-06 16:26:56 +00:00
|
|
|
case PacketReceiver::DELIVERY_OK:
|
|
|
|
|
break;
|
|
|
|
|
case PacketReceiver::DELIVERY_UNKNOWN_SSRC: {
|
|
|
|
|
RTPHeader header;
|
2016-03-01 11:52:33 -08:00
|
|
|
std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
|
2014-08-06 16:26:56 +00:00
|
|
|
parser->Parse(packet.data, packet.length, &header);
|
2014-08-07 14:42:45 +00:00
|
|
|
if (unknown_packets[header.ssrc] == 0)
|
|
|
|
|
fprintf(stderr, "Unknown SSRC: %u!\n", header.ssrc);
|
|
|
|
|
++unknown_packets[header.ssrc];
|
2014-08-06 16:26:56 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2017-01-26 04:54:04 -08:00
|
|
|
case PacketReceiver::DELIVERY_PACKET_ERROR: {
|
2014-08-06 16:26:56 +00:00
|
|
|
fprintf(stderr, "Packet error, corrupt packets or incorrect setup?\n");
|
2017-01-26 04:54:04 -08:00
|
|
|
RTPHeader header;
|
|
|
|
|
std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
|
|
|
|
|
parser->Parse(packet.data, packet.length, &header);
|
2017-06-29 07:42:18 -07:00
|
|
|
fprintf(stderr, "Packet len=%zu pt=%u seq=%u ts=%u ssrc=0x%8x\n",
|
2017-07-06 04:38:06 -07:00
|
|
|
packet.length, header.payloadType, header.sequenceNumber,
|
|
|
|
|
header.timestamp, header.ssrc);
|
2014-08-06 16:26:56 +00:00
|
|
|
break;
|
2017-01-26 04:54:04 -08:00
|
|
|
}
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
if (last_time_ms != 0 && last_time_ms != packet.time_ms) {
|
|
|
|
|
SleepMs(packet.time_ms - last_time_ms);
|
|
|
|
|
}
|
|
|
|
|
last_time_ms = packet.time_ms;
|
|
|
|
|
}
|
|
|
|
|
fprintf(stderr, "num_packets: %d\n", num_packets);
|
|
|
|
|
|
2014-08-07 14:42:45 +00:00
|
|
|
for (std::map<uint32_t, int>::const_iterator it = unknown_packets.begin();
|
|
|
|
|
it != unknown_packets.end();
|
|
|
|
|
++it) {
|
|
|
|
|
fprintf(
|
|
|
|
|
stderr, "Packets for unknown ssrc '%u': %d\n", it->first, it->second);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-06 16:26:56 +00:00
|
|
|
call->DestroyVideoReceiveStream(receive_stream);
|
2014-10-29 15:28:39 +00:00
|
|
|
|
|
|
|
|
delete decoder.decoder;
|
2014-08-06 16:26:56 +00:00
|
|
|
}
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
2017-08-31 03:21:39 -07:00
|
|
|
if (rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, true)) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
if (webrtc::flags::FLAG_help) {
|
|
|
|
|
rtc::FlagList::Print(nullptr, false);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RTC_CHECK(ValidatePayloadType(webrtc::flags::FLAG_payload_type));
|
|
|
|
|
RTC_CHECK(ValidatePayloadType(webrtc::flags::FLAG_payload_type_rtx));
|
|
|
|
|
RTC_CHECK(ValidateSsrc(webrtc::flags::FLAG_ssrc));
|
|
|
|
|
RTC_CHECK(ValidateSsrc(webrtc::flags::FLAG_ssrc_rtx));
|
|
|
|
|
RTC_CHECK(ValidateOptionalPayloadType(webrtc::flags::FLAG_red_payload_type));
|
|
|
|
|
RTC_CHECK(ValidateOptionalPayloadType(webrtc::flags::FLAG_fec_payload_type));
|
|
|
|
|
RTC_CHECK(ValidateRtpHeaderExtensionId(webrtc::flags::FLAG_abs_send_time_id));
|
|
|
|
|
RTC_CHECK(ValidateRtpHeaderExtensionId(
|
|
|
|
|
webrtc::flags::FLAG_transmission_offset_id));
|
|
|
|
|
RTC_CHECK(ValidateInputFilenameNotEmpty(webrtc::flags::FLAG_input_file));
|
2014-08-06 16:26:56 +00:00
|
|
|
|
|
|
|
|
webrtc::test::RunTest(webrtc::RtpReplay);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|