提交 d30b3cc6 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

foo

上级 8304e547
# TODO in mediasoup v2 (server-side)
* Redo the compile_commands_template.json.
* worker: All the RTC emthods in Producer and Consumer do a `MS_ASSERT(Enabled();` (meaning that they already have `transport` and `rtpParameters`). Producers/Consumers without them are not present in the Router `mapProducerConsumers`/`mapConsumerProducer` maps. However *THEY DO EXIST* in the Sets of `producers` and `consumers` of the Transport.
- So: before calling any RTC method on a Producer/Consumer, the Transport must check `producer/consumer->IsEnabled()` and ignore if not.
* JS: Do we need to close Producers/Consumers in Peer.close? If we close Transports then Producers and Consumers get also closed in the worker. The C++ Transport closes all its Producers and Consumers, and the client side gets producer.on('unhandled'), there is no need to close/destroy its local Producer.
- So, do we need to `producerClosed` notification? I don't think so...
```js
// On Transport closure close the Producer.
transport.on('@close', () =>
{
if (!producer.closed)
producer.close();
});
```
* If a Transport is closed, Producers using it do not realize, and will crash if they try to send RTCP or whatever.
- Yep, we'd should just close Producers if their Transport is closed.
- Not sure if the same for Consumers. Let's see.
* Does `CONSUMER_ENABLE` makes sense? IMHO it's better to keep the Consumer just in JS and call `CREATE_CONSUMER` (by passing `rtpParameters` and `transportId`) once enabled for reception in JS.
- I've removed it.
- mmm... not sure.
* Remove all the "close" events in C++. May be leave the `transport.on('close')`.
* Move the RTCP timer from Peer to Transport.
......
......@@ -13,9 +13,9 @@
#include "RTC/RtpStreamRecv.hpp"
#include "RTC/Transport.hpp"
#include <json/json.h>
#include <unordered_set>
#include <map>
#include <string>
#include <unordered_set>
namespace RTC
{
......
......@@ -18,8 +18,13 @@ namespace RTC
/* Instance methods. */
Consumer::Consumer(
Channel::Notifier* notifier, uint32_t consumerId, RTC::Media::Kind kind, uint32_t sourceProducerId, RTC::Transport* transport)
: consumerId(consumerId), kind(kind), sourceProducerId(sourceProducerId), notifier(notifier), transport(transport)
Channel::Notifier* notifier,
uint32_t consumerId,
RTC::Media::Kind kind,
uint32_t sourceProducerId,
RTC::Transport* transport)
: consumerId(consumerId), kind(kind), sourceProducerId(sourceProducerId), notifier(notifier),
transport(transport)
{
MS_TRACE();
......@@ -59,7 +64,9 @@ namespace RTC
static const Json::StaticString JsonStringSourceProducerId{ "sourceProducerId" };
static const Json::StaticString JsonStringRtpParameters{ "rtpParameters" };
static const Json::StaticString JsonStringRtpStream{ "rtpStream" };
static const Json::StaticString JsonStringSupportedCodecPayloadTypes{ "supportedCodecPayloadTypes" };
static const Json::StaticString JsonStringSupportedCodecPayloadTypes{
"supportedCodecPayloadTypes"
};
static const Json::StaticString JsonStringPaused{ "paused" };
Json::Value json(Json::objectValue);
......@@ -210,8 +217,7 @@ namespace RTC
// TODO: We should just ignore those packets as they have non been negotiated.
if (it == this->supportedCodecPayloadTypes.end())
{
MS_WARN_DEV(
"payload type not supported [payloadType:%" PRIu8 "]", payloadType);
MS_WARN_DEV("payload type not supported [payloadType:%" PRIu8 "]", payloadType);
return;
}
......
......@@ -265,7 +265,7 @@ namespace RTC
MS_THROW_ERROR("missing kind");
std::string kindStr = request->data[JsonStringKind].asString();
auto kind = RTC::Media::GetKind(kindStr);
auto kind = RTC::Media::GetKind(kindStr);
// Create a Producer instance.
try
......@@ -380,7 +380,7 @@ namespace RTC
MS_THROW_ERROR("missing kind");
std::string kindStr = request->data[JsonStringKind].asString();
auto kind = RTC::Media::GetKind(kindStr);
auto kind = RTC::Media::GetKind(kindStr);
if (kind != producer->kind)
MS_THROW_ERROR("not matching kind");
......@@ -388,7 +388,8 @@ namespace RTC
// Create a Consumer instance.
try
{
consumer = new RTC::Consumer(this->notifier, consumerId, kind, producer->producerId, transport);
consumer =
new RTC::Consumer(this->notifier, consumerId, kind, producer->producerId, transport);
// Add us as listener.
consumer->AddListener(this);
......@@ -782,7 +783,7 @@ namespace RTC
if (packet->ReadAudioLevel(&volume, &voice))
{
int8_t dBov = volume * -1;
int8_t dBov = volume * -1;
auto& audioLevelContainer = this->mapProducerAudioLevelContainer[producer];
audioLevelContainer.numdBovs++;
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论