Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit d7dcb33

Browse files
committed
WebTransportStream sends frames to internal server.
1 parent ff9cfd1 commit d7dcb33

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

source/agent/addons/common/MediaFramePipelineWrapper.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
#ifndef MEDIAFRAMEPIPELINEWRAPPER_H
77
#define MEDIAFRAMEPIPELINEWRAPPER_H
88

9+
#include <MediaFramePipeline.h>
10+
#include <nan.h>
911
#include <node.h>
1012
#include <node_object_wrap.h>
11-
#include <MediaFramePipeline.h>
12-
1313

1414
/*
1515
* Wrapper class of owt_base::FrameDestination
@@ -30,5 +30,13 @@ class FrameSource : public node::ObjectWrap{
3030
owt_base::FrameSource* src;
3131
};
3232

33+
/*
34+
* Nan::ObjectWrap of owt_base::FrameSource and owt_base::FrameDestination, represents a node in the media or data pipeline.
35+
*/
36+
class NanFrameNode : public Nan::ObjectWrap {
37+
public:
38+
virtual owt_base::FrameSource* FrameSource() = 0;
39+
virtual owt_base::FrameDestination* FrameDestination() = 0;
40+
};
3341

3442
#endif

source/agent/addons/quic/QuicTransportStream.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@
99

1010
#include "owt/quic/web_transport_stream_interface.h"
1111
#include "../../core/owt_base/MediaFramePipeline.h"
12+
#include "../common/MediaFramePipelineWrapper.h"
1213
#include <logger.h>
1314
#include <nan.h>
1415
#include <mutex>
1516
#include <string>
1617

17-
class QuicTransportStream : public owt_base::FrameSource, public owt_base::FrameDestination, public Nan::ObjectWrap, public owt::quic::WebTransportStreamInterface::Visitor {
18+
class QuicTransportStream : public owt_base::FrameSource, public owt_base::FrameDestination, public NanFrameNode, public owt::quic::WebTransportStreamInterface::Visitor {
1819
DECLARE_LOGGER();
1920

2021
public:
@@ -45,6 +46,10 @@ class QuicTransportStream : public owt_base::FrameSource, public owt_base::Frame
4546
void onFrame(const owt_base::Frame&) override;
4647
void onVideoSourceChanged() override;
4748

49+
// Overrides NanFrameNode.
50+
owt_base::FrameSource* FrameSource() override { return this; }
51+
owt_base::FrameDestination* FrameDestination() override { return this; }
52+
4853
static Nan::Persistent<v8::Function> s_constructor;
4954

5055
protected:

source/agent/internalConnectionRouter.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ class InternalConnectionRouter {
167167
* @param {FrameSource} source Wrapper class for FrameSource
168168
*/
169169
addLocalSource(id, type, source) {
170-
log.debug('addLocalSource:', id, type);
171-
this.internalServer.addSource(id, source);
170+
const isNativeSource = (type === 'quic');
171+
this.internalServer.addSource(id, source, isNativeSource);
172172
return this.connections.addConnection(id, type, '', source, 'in');
173173
}
174174

@@ -191,7 +191,11 @@ class InternalConnectionRouter {
191191
return this.removeLocalSource(id);
192192
} else if (conn.direction === 'out') {
193193
return this.removeLocalDestination(id);
194+
} else {
195+
return Promise.reject('Unexpected direction '+conn.direction);
194196
}
197+
} else {
198+
return Promise.reject('Cannot find connection.');
195199
}
196200
}
197201

0 commit comments

Comments
 (0)