2015-09-24 16:47:53 -07:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
2015-09-24 16:47:53 -07:00
|
|
|
*
|
2016-02-10 07:54:43 -08:00
|
|
|
* 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-09-24 16:47:53 -07:00
|
|
|
*/
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/rtp_receiver.h"
|
2015-09-24 16:47:53 -07:00
|
|
|
|
2018-11-28 16:47:49 +01:00
|
|
|
#include <stddef.h>
|
2019-07-05 19:08:33 +02:00
|
|
|
|
2024-01-25 08:34:26 +00:00
|
|
|
#include <atomic>
|
2024-06-04 21:29:14 +00:00
|
|
|
#include <string>
|
2017-11-21 13:41:51 +01:00
|
|
|
#include <utility>
|
2017-10-30 09:57:42 -07:00
|
|
|
#include <vector>
|
|
|
|
|
|
2024-06-04 21:29:14 +00:00
|
|
|
#include "api/media_stream_interface.h"
|
|
|
|
|
#include "api/scoped_refptr.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/media_stream.h"
|
2021-05-26 18:56:30 +02:00
|
|
|
#include "pc/media_stream_proxy.h"
|
2022-02-23 13:44:59 +00:00
|
|
|
#include "rtc_base/thread.h"
|
2015-09-28 16:53:55 -07:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2018-01-11 17:18:19 +01:00
|
|
|
// This function is only expected to be called on the signalling thread.
|
2024-01-25 08:34:26 +00:00
|
|
|
// On the other hand, some test or even production setups may use
|
|
|
|
|
// several signaling threads.
|
2019-02-11 10:29:19 +01:00
|
|
|
int RtpReceiverInternal::GenerateUniqueId() {
|
2024-01-25 08:34:26 +00:00
|
|
|
static std::atomic<int> g_unique_id{0};
|
2018-01-11 17:18:19 +01:00
|
|
|
|
|
|
|
|
return ++g_unique_id;
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-11 10:29:19 +01:00
|
|
|
std::vector<rtc::scoped_refptr<MediaStreamInterface>>
|
|
|
|
|
RtpReceiverInternal::CreateStreamsFromIds(std::vector<std::string> stream_ids) {
|
2018-07-04 20:51:53 +02:00
|
|
|
std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams(
|
|
|
|
|
stream_ids.size());
|
|
|
|
|
for (size_t i = 0; i < stream_ids.size(); ++i) {
|
|
|
|
|
streams[i] = MediaStreamProxy::Create(
|
|
|
|
|
rtc::Thread::Current(), MediaStream::Create(std::move(stream_ids[i])));
|
|
|
|
|
}
|
|
|
|
|
return streams;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-28 16:53:55 -07:00
|
|
|
} // namespace webrtc
|