Changes name of RtpTransceiverInit's stream_labels to stream_ids.
The naming convention according to the spec is stream id, not stream labels.Changing things now to be spec compliant, before it is widely used. This also includes changes to objective C wrapper code to be in sync with the change. Bug: webrtc:7932 Change-Id: I5705e6d8a647aaeed860316466a7320132f24b00 Reviewed-on: https://webrtc-review.googlesource.com/59301 Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Reviewed-by: Kári Helgason <kthelgason@webrtc.org> Reviewed-by: Steve Anton <steveanton@webrtc.org> Commit-Queue: Seth Hampson <shampson@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22316}
This commit is contained in:
parent
8e20f17d1d
commit
513449eab9
@ -43,7 +43,7 @@ struct RtpTransceiverInit final {
|
||||
// TODO(shampson): Change name to stream_id & update native wrapper's naming
|
||||
// as well.
|
||||
// TODO(bugs.webrtc.org/7600): Not implemented.
|
||||
std::vector<std::string> stream_labels;
|
||||
std::vector<std::string> stream_ids;
|
||||
|
||||
// TODO(bugs.webrtc.org/7600): Not implemented.
|
||||
std::vector<RtpEncodingParameters> send_encodings;
|
||||
|
||||
@ -692,10 +692,10 @@ static int const kKbpsMultiplier = 1000;
|
||||
RTCAudioSource *source = [_factory audioSourceWithConstraints:constraints];
|
||||
RTCAudioTrack *track = [_factory audioTrackWithSource:source
|
||||
trackId:kARDAudioTrackId];
|
||||
[_peerConnection addTrack:track streamLabels:@[ kARDMediaStreamId ]];
|
||||
[_peerConnection addTrack:track streamIds:@[ kARDMediaStreamId ]];
|
||||
_localVideoTrack = [self createLocalVideoTrack];
|
||||
if (_localVideoTrack) {
|
||||
[_peerConnection addTrack:_localVideoTrack streamLabels:@[ kARDMediaStreamId ]];
|
||||
[_peerConnection addTrack:_localVideoTrack streamIds:@[ kARDMediaStreamId ]];
|
||||
// We can set up rendering for the remote track right away since the transceiver already has an
|
||||
// RTCRtpReceiver with a track. The track will automatically get unmuted and produce frames
|
||||
// once RTP is received.
|
||||
|
||||
@ -408,7 +408,7 @@ std::unique_ptr<cricket::VideoCapturer> Conductor::OpenVideoCaptureDevice() {
|
||||
}
|
||||
|
||||
void Conductor::AddStreams() {
|
||||
if (active_streams_.find(kStreamLabel) != active_streams_.end())
|
||||
if (active_streams_.find(kStreamId) != active_streams_.end())
|
||||
return; // Already added.
|
||||
|
||||
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
|
||||
@ -429,7 +429,7 @@ void Conductor::AddStreams() {
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
|
||||
peer_connection_factory_->CreateLocalMediaStream(kStreamLabel);
|
||||
peer_connection_factory_->CreateLocalMediaStream(kStreamId);
|
||||
|
||||
stream->AddTrack(audio_track);
|
||||
if (video_track)
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
const char kAudioLabel[] = "audio_label";
|
||||
const char kVideoLabel[] = "video_label";
|
||||
const char kStreamLabel[] = "stream_label";
|
||||
const char kStreamId[] = "stream_id";
|
||||
const uint16_t kDefaultServerPort = 8888;
|
||||
|
||||
std::string GetEnvVarOrDefault(const char* env_var_name,
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
extern const char kAudioLabel[];
|
||||
extern const char kVideoLabel[];
|
||||
extern const char kStreamLabel[];
|
||||
extern const char kStreamId[];
|
||||
extern const uint16_t kDefaultServerPort;
|
||||
|
||||
std::string GetEnvVarOrDefault(const char* env_var_name,
|
||||
|
||||
@ -33,10 +33,10 @@
|
||||
#include "sdk/android/src/jni/jni_helpers.h"
|
||||
#endif
|
||||
|
||||
// Names used for media stream labels.
|
||||
// Names used for media stream ids.
|
||||
const char kAudioLabel[] = "audio_label";
|
||||
const char kVideoLabel[] = "video_label";
|
||||
const char kStreamLabel[] = "stream_label";
|
||||
const char kStreamId[] = "stream_id";
|
||||
|
||||
namespace {
|
||||
static int g_peer_count = 0;
|
||||
@ -418,11 +418,11 @@ SimplePeerConnection::OpenVideoCaptureDevice() {
|
||||
}
|
||||
|
||||
void SimplePeerConnection::AddStreams(bool audio_only) {
|
||||
if (active_streams_.find(kStreamLabel) != active_streams_.end())
|
||||
if (active_streams_.find(kStreamId) != active_streams_.end())
|
||||
return; // Already added.
|
||||
|
||||
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream =
|
||||
g_peer_connection_factory->CreateLocalMediaStream(kStreamLabel);
|
||||
g_peer_connection_factory->CreateLocalMediaStream(kStreamId);
|
||||
|
||||
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
|
||||
g_peer_connection_factory->CreateAudioTrack(
|
||||
|
||||
@ -1351,14 +1351,13 @@ PeerConnection::AddTransceiver(
|
||||
|
||||
// TODO(bugs.webrtc.org/7600): Verify init.
|
||||
|
||||
if (init.stream_labels.size() > 1u) {
|
||||
if (init.stream_ids.size() > 1u) {
|
||||
LOG_AND_RETURN_ERROR(RTCErrorType::UNSUPPORTED_PARAMETER,
|
||||
"More than one stream is not yet supported.");
|
||||
}
|
||||
|
||||
std::vector<std::string> stream_ids = {!init.stream_labels.empty()
|
||||
? init.stream_labels[0]
|
||||
: rtc::CreateRandomUuid()};
|
||||
std::vector<std::string> stream_ids = {
|
||||
!init.stream_ids.empty() ? init.stream_ids[0] : rtc::CreateRandomUuid()};
|
||||
|
||||
auto sender = CreateSender(media_type, track, stream_ids);
|
||||
auto receiver = CreateReceiver(media_type, rtc::CreateRandomUuid());
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
}
|
||||
|
||||
- (NSString *)streamId {
|
||||
return [NSString stringForStdString:_nativeMediaStream->label()];
|
||||
return [NSString stringForStdString:_nativeMediaStream->id()];
|
||||
}
|
||||
|
||||
- (void)addAudioTrack:(RTCAudioTrack *)audioTrack {
|
||||
|
||||
@ -367,14 +367,13 @@ void PeerConnectionDelegateAdapter::OnAddTrack(
|
||||
[_localStreams removeObject:stream];
|
||||
}
|
||||
|
||||
- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track
|
||||
streamLabels:(NSArray<NSString *> *)streamLabels {
|
||||
std::vector<std::string> nativeStreamLabels;
|
||||
for (NSString *label in streamLabels) {
|
||||
nativeStreamLabels.push_back([label UTF8String]);
|
||||
- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track streamIds:(NSArray<NSString *> *)streamIds {
|
||||
std::vector<std::string> nativeStreamIds;
|
||||
for (NSString *streamId in streamIds) {
|
||||
nativeStreamIds.push_back([streamId UTF8String]);
|
||||
}
|
||||
webrtc::RTCErrorOr<rtc::scoped_refptr<webrtc::RtpSenderInterface>> nativeSenderOrError =
|
||||
_peerConnection->AddTrack(track.nativeTrack, nativeStreamLabels);
|
||||
_peerConnection->AddTrack(track.nativeTrack, nativeStreamIds);
|
||||
if (!nativeSenderOrError.ok()) {
|
||||
RTCLogError(@"Failed to add track %@: %s", track, nativeSenderOrError.error().message());
|
||||
return nil;
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
@implementation RTCRtpTransceiverInit
|
||||
|
||||
@synthesize direction = _direction;
|
||||
@synthesize streamLabels = _streamLabels;
|
||||
@synthesize streamIds = _streamIds;
|
||||
@synthesize sendEncodings = _sendEncodings;
|
||||
|
||||
- (instancetype)init {
|
||||
@ -33,8 +33,8 @@
|
||||
- (webrtc::RtpTransceiverInit)nativeInit {
|
||||
webrtc::RtpTransceiverInit init;
|
||||
init.direction = [RTCRtpTransceiver nativeRtpTransceiverDirectionFromDirection:_direction];
|
||||
for (NSString *streamLabel in _streamLabels) {
|
||||
init.stream_labels.push_back([streamLabel UTF8String]);
|
||||
for (NSString *streamId in _streamIds) {
|
||||
init.stream_ids.push_back([streamId UTF8String]);
|
||||
}
|
||||
for (RTCRtpEncodingParameters *sendEncoding in _sendEncodings) {
|
||||
init.send_encodings.push_back(sendEncoding.nativeParameters);
|
||||
|
||||
@ -201,14 +201,13 @@ RTC_EXPORT
|
||||
|
||||
/** Add a new media stream track to be sent on this peer connection, and return
|
||||
* the newly created RTCRtpSender. The RTCRtpSender will be associated with
|
||||
* the streams specified in the |streamLabels| list.
|
||||
* the streams specified in the |streamIds| list.
|
||||
*
|
||||
* Errors: If an error occurs, returns nil. An error can occur if:
|
||||
* - A sender already exists for the track.
|
||||
* - The peer connection is closed.
|
||||
*/
|
||||
- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track
|
||||
streamLabels:(NSArray<NSString *> *)streamLabels;
|
||||
- (RTCRtpSender *)addTrack:(RTCMediaStreamTrack *)track streamIds:(NSArray<NSString *> *)streamIds;
|
||||
|
||||
/** With PlanB semantics, removes an RTCRtpSender from this peer connection.
|
||||
*
|
||||
|
||||
@ -34,7 +34,7 @@ typedef NS_ENUM(NSInteger, RTCRtpTransceiverDirection) {
|
||||
@property(nonatomic) RTCRtpTransceiverDirection direction;
|
||||
|
||||
/** The added RTCRtpTransceiver will be added to these streams. */
|
||||
@property(nonatomic) NSArray<NSString *> *streamLabels;
|
||||
@property(nonatomic) NSArray<NSString *> *streamIds;
|
||||
|
||||
/** TODO(bugs.webrtc.org/7600): Not implemented. */
|
||||
@property(nonatomic) NSArray<RTCRtpEncodingParameters *> *sendEncodings;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user