Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Wire up media streams #14

Open
wants to merge 1 commit into
base: multistream
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dom/media/PeerConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ RTCPeerConnection.prototype = {
_addIceCandidate: function(cand) {
this._impl.addIceCandidate(cand.candidate, cand.sdpMid || "",
(cand.sdpMLineIndex === null) ? 0 :
cand.sdpMLineIndex + 1);
cand.sdpMLineIndex);
},

addStream: function(stream) {
Expand Down Expand Up @@ -1207,7 +1207,7 @@ PeerConnectionObserver.prototype = {
{
candidate: candidate,
sdpMid: mid,
sdpMLineIndex: level - 1
sdpMLineIndex: level
}
));
}
Expand Down
29 changes: 23 additions & 6 deletions media/mtransport/transportlayerice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,32 @@ namespace mozilla {

MOZ_MTLOG_MODULE("mtransport")

TransportLayerIce::TransportLayerIce(const std::string& name)
: name_(name), ctx_(nullptr), stream_(nullptr), component_(0) {}

TransportLayerIce::TransportLayerIce(const std::string& name,
RefPtr<NrIceCtx> ctx, RefPtr<NrIceMediaStream> stream,
RefPtr<NrIceCtx> ctx, RefPtr<NrIceMediaStream> stream,
int component)
: name_(name), ctx_(ctx), stream_(stream), component_(component) {
target_ = ctx->thread();
PostSetup();
}

TransportLayerIce::~TransportLayerIce() {
// No need to do anything here, since we use smart pointers
}

void TransportLayerIce::SetParameters(RefPtr<NrIceCtx> ctx,
RefPtr<NrIceMediaStream> stream,
int component) {
ctx_ = ctx;
stream_ = stream;
component_ = component;

PostSetup();
}

void TransportLayerIce::PostSetup() {
target_ = ctx_->thread();

stream_->SignalReady.connect(this, &TransportLayerIce::IceReady);
stream_->SignalFailed.connect(this, &TransportLayerIce::IceFailed);
Expand All @@ -99,10 +120,6 @@ TransportLayerIce::TransportLayerIce(const std::string& name,
}
}

TransportLayerIce::~TransportLayerIce() {
// No need to do anything here, since we use smart pointers
}

TransportResult TransportLayerIce::SendPacket(const unsigned char *data,
size_t len) {
CheckThread();
Expand Down
7 changes: 7 additions & 0 deletions media/mtransport/transportlayerice.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ class TransportLayerIce : public TransportLayer {
RefPtr<NrIceCtx> ctx,
RefPtr<NrIceMediaStream> stream,
int component);
TransportLayerIce(const std::string& name);

virtual ~TransportLayerIce();

void SetParameters(RefPtr<NrIceCtx> ctx,
RefPtr<NrIceMediaStream> stream,
int component);

// Transport layer overrides.
virtual TransportResult SendPacket(const unsigned char *data, size_t len);

Expand All @@ -51,6 +57,7 @@ class TransportLayerIce : public TransportLayer {

private:
DISALLOW_COPY_ASSIGN(TransportLayerIce);
void PostSetup();

const std::string name_;
RefPtr<NrIceCtx> ctx_;
Expand Down
1 change: 1 addition & 0 deletions media/webrtc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if CONFIG['MOZ_WEBRTC_SIGNALING']:
'signaling/src/mediapipeline/MediaPipeline.cpp',
'signaling/src/mediapipeline/MediaPipelineFilter.cpp',
'signaling/src/mediapipeline/SrtpFlow.cpp',
'signaling/src/peerconnection/MediaPipelineFactory.cpp',
'signaling/src/peerconnection/MediaStreamList.cpp',
'signaling/src/peerconnection/PeerConnectionCtx.cpp',
'signaling/src/peerconnection/PeerConnectionImpl.cpp',
Expand Down
2 changes: 2 additions & 0 deletions media/webrtc/signaling/signaling.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
'./src/common/time_profiling/timecard.c',
'./src/common/time_profiling/timecard.h',
# PeerConnection
'./src/peerconnection/MediaPipelineFactory.cpp',
'./src/peerconnection/MediaPipelineFactory.h',
'./src/peerconnection/MediaStreamList.cpp',
'./src/peerconnection/MediaStreamList.h',
'./src/peerconnection/PeerConnectionCtx.cpp',
Expand Down
46 changes: 43 additions & 3 deletions media/webrtc/signaling/src/jsep/JsepCodecDescription.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,33 @@
#ifndef _JSEPCODECDESCRIPTION_H_
#define _JSEPCODECDESCRIPTION_H_

#include <iostream>
#include <string>
#include "signaling/src/sdp/SdpMediaSection.h"

namespace mozilla {
namespace jsep {

#define JSEP_CODEC_CLONE(T) \
virtual JsepCodecDescription* clone() { return new T(*this); }

// A single entry in our list of known codecs.
struct JsepCodecDescription {
JsepCodecDescription(mozilla::SdpMediaSection::MediaType type,
uint8_t default_pt,
const std::string& name,
uint32_t clock,
uint32_t channels,
bool enabled = true) :
bool enabled) :
mType(type),
mDefaultPt(default_pt),
mName(name),
mClock(clock),
mChannels(channels),
mEnabled(enabled) {}
virtual ~JsepCodecDescription() {}

// These should be const except for enabled, but then
// I can't assign, which is sad.
virtual JsepCodecDescription* clone() = 0;

mozilla::SdpMediaSection::MediaType mType;
uint8_t mDefaultPt;
Expand All @@ -37,6 +41,42 @@ struct JsepCodecDescription {
bool mEnabled;
};


struct JsepAudioCodecDescription : public JsepCodecDescription {
JsepAudioCodecDescription(uint8_t default_pt,
const std::string& name,
uint32_t clock,
uint32_t channels,
uint32_t packet_size = 0, // TODO([email protected]): Remove when I have reasonable defaults.
uint32_t bit_rate = 0,
bool enabled = true) :
JsepCodecDescription(mozilla::SdpMediaSection::kAudio,
default_pt, name, clock, channels, enabled),
mPacketSize(packet_size),
mBitrate(bit_rate) {}

JSEP_CODEC_CLONE(JsepAudioCodecDescription)

uint32_t mPacketSize;
uint32_t mBitrate;
};


struct JsepVideoCodecDescription : public JsepCodecDescription {
JsepVideoCodecDescription(uint8_t default_pt,
const std::string& name,
uint32_t clock,
bool enabled = true) :
JsepCodecDescription(mozilla::SdpMediaSection::kVideo,
default_pt, name, clock, 0, enabled) {}

JSEP_CODEC_CLONE(JsepVideoCodecDescription)

uint32_t mFbTypes;
uint32_t mMaxFs;
uint32_t mMaxFr; // TODO([email protected]): Update for H.264
};

} // namespace jsep
} // namespace mozilla

Expand Down
1 change: 1 addition & 0 deletions media/webrtc/signaling/src/jsep/JsepSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class JsepSession {
virtual nsresult AddIceCandidate(const std::string& candidate,
const std::string& mid,
uint16_t level) = 0;
virtual nsresult Close() = 0;

// ICE controlling or controlled
virtual bool ice_controlling() const = 0;
Expand Down
Loading