2013-05-16 12:08:03 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2013 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.
|
|
|
|
|
*/
|
2015-12-09 12:13:30 +01:00
|
|
|
#ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_
|
|
|
|
|
#define WEBRTC_TEST_DIRECT_TRANSPORT_H_
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2013-08-05 12:01:36 +00:00
|
|
|
#include <assert.h>
|
|
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
#include <memory>
|
2013-08-12 12:59:04 +00:00
|
|
|
|
2016-11-28 07:02:13 -08:00
|
|
|
#include "webrtc/api/call/transport.h"
|
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
|
|
|
#include "webrtc/call/call.h"
|
2017-08-22 04:02:52 -07:00
|
|
|
#include "webrtc/rtc_base/sequenced_task_checker.h"
|
2017-08-24 05:04:56 -07:00
|
|
|
#include "webrtc/rtc_base/thread_annotations.h"
|
2013-12-18 20:28:25 +00:00
|
|
|
#include "webrtc/test/fake_network_pipe.h"
|
2017-08-22 04:02:52 -07:00
|
|
|
#include "webrtc/test/single_threaded_task_queue.h"
|
2013-05-16 12:08:03 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2013-08-12 12:59:04 +00:00
|
|
|
|
2013-11-18 11:45:11 +00:00
|
|
|
class Clock;
|
2013-08-12 12:59:04 +00:00
|
|
|
class PacketReceiver;
|
|
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
namespace test {
|
|
|
|
|
|
2017-08-24 05:04:56 -07:00
|
|
|
// Objects of this class are expected to be allocated and destroyed on the
|
|
|
|
|
// same task-queue - the one that's passed in via the constructor.
|
2015-09-28 09:59:31 -07:00
|
|
|
class DirectTransport : public Transport {
|
2013-05-16 12:08:03 +00:00
|
|
|
public:
|
2017-08-22 04:02:52 -07:00
|
|
|
DirectTransport(SingleThreadedTaskQueueForTesting* task_queue,
|
|
|
|
|
Call* send_call,
|
|
|
|
|
const std::map<uint8_t, MediaType>& payload_type_map);
|
|
|
|
|
|
|
|
|
|
DirectTransport(SingleThreadedTaskQueueForTesting* task_queue,
|
|
|
|
|
const FakeNetworkPipe::Config& config,
|
|
|
|
|
Call* send_call,
|
|
|
|
|
const std::map<uint8_t, MediaType>& payload_type_map);
|
|
|
|
|
|
|
|
|
|
DirectTransport(SingleThreadedTaskQueueForTesting* task_queue,
|
|
|
|
|
const FakeNetworkPipe::Config& config,
|
|
|
|
|
Call* send_call,
|
|
|
|
|
std::unique_ptr<Demuxer> demuxer);
|
|
|
|
|
|
2017-08-03 07:44:08 -07:00
|
|
|
~DirectTransport() override;
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2014-02-26 13:34:52 +00:00
|
|
|
void SetConfig(const FakeNetworkPipe::Config& config);
|
|
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
RTC_DEPRECATED void StopSending();
|
|
|
|
|
|
2015-10-27 08:29:42 -07:00
|
|
|
// TODO(holmer): Look into moving this to the constructor.
|
2013-08-23 09:19:30 +00:00
|
|
|
virtual void SetReceiver(PacketReceiver* receiver);
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2015-10-02 03:39:33 -07:00
|
|
|
bool SendRtp(const uint8_t* data,
|
|
|
|
|
size_t length,
|
|
|
|
|
const PacketOptions& options) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool SendRtcp(const uint8_t* data, size_t length) override;
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2016-01-14 10:00:21 +01:00
|
|
|
int GetAverageDelayMs();
|
|
|
|
|
|
2013-05-16 12:08:03 +00:00
|
|
|
private:
|
2017-08-22 04:02:52 -07:00
|
|
|
void SendPackets();
|
2013-08-12 12:59:04 +00:00
|
|
|
|
2015-10-27 08:29:42 -07:00
|
|
|
Call* const send_call_;
|
2014-04-28 13:00:21 +00:00
|
|
|
Clock* const clock_;
|
2013-08-12 12:59:04 +00:00
|
|
|
|
2017-08-22 04:02:52 -07:00
|
|
|
// TODO(eladalon): Make |task_queue_| const.
|
|
|
|
|
// https://bugs.chromium.org/p/webrtc/issues/detail?id=8125
|
|
|
|
|
SingleThreadedTaskQueueForTesting* task_queue_;
|
2017-08-24 05:04:56 -07:00
|
|
|
SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_
|
|
|
|
|
GUARDED_BY(&sequence_checker_);
|
2013-08-12 14:28:00 +00:00
|
|
|
|
2013-12-18 20:28:25 +00:00
|
|
|
FakeNetworkPipe fake_network_;
|
2017-08-22 04:02:52 -07:00
|
|
|
|
|
|
|
|
rtc::SequencedTaskChecker sequence_checker_;
|
2013-05-16 12:08:03 +00:00
|
|
|
};
|
2013-08-12 12:59:04 +00:00
|
|
|
} // namespace test
|
|
|
|
|
} // namespace webrtc
|
2013-05-16 12:08:03 +00:00
|
|
|
|
2015-12-09 12:13:30 +01:00
|
|
|
#endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_
|