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

upgrade to webrtc m120-6099。 #32

Open
wants to merge 2 commits into
base: v3
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
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ set(broadcaster_VERSION_MAJOR 0)
set(broadcaster_VERSION_MINOR 1)

# C++ standard requirements.
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -v -Wall -stdlib=libc++") # v:显示详细信息 Wall:启用所有编译器警告
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") # debug开启调试, cmake -DCMAKE_BUILD_TYPE=Debug /path/to/source
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -g") # release

message("\n=========== mediasoup-broadcaster-demo Build Configuration ===========\n")
message(STATUS "LIBWEBRTC_INCLUDE_PATH : " ${LIBWEBRTC_INCLUDE_PATH})
Expand Down Expand Up @@ -52,8 +56,8 @@ include(FetchContent)
message(STATUS "\nFetching mediasoupclient...\n")
FetchContent_Declare(
mediasoupclient
GIT_REPOSITORY https://github.com/versatica/libmediasoupclient.git
GIT_TAG v3
GIT_REPOSITORY git@github.com:janreyho/libmediasoupclient.git
GIT_TAG m120
Comment on lines +59 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, put v3 back since the branch has already been merged.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'll fix it tomorrow.

Copy link
Author

@janreyho janreyho Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have successfully solved Thousands of std::__Cr:: related errors in ubuntu2204, using libc++ and libc++abi from the webrtc source code.

There are about 10 link errors left, and I will try to solve them this weekend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have successfully solved Thousands of std::__Cr:: related errors in ubuntu2204, using libc++ and libc++abi from the webrtc source code.

Do you mean specifying use_custom_libcxx=false in gn gen command?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, use buildtools/third_party/libc++, and buildtools/third_party/libc++abi

It may take a few more days to resolve the last dozen issues on Ubuntu 22.04. Once the modifications are complete, I will create PRs for the mediasoup-broadcaster-demo and libmediasoupclient repositories.

)
FetchContent_MakeAvailable(mediasoupclient)

Expand Down
2 changes: 1 addition & 1 deletion deps/libwebrtc/media/base/fake_frame_source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ webrtc::VideoFrame FakeFrameSource::GetFrameRotationApplied() {
case webrtc::kVideoRotation_270:
return GetFrame(height_, width_, webrtc::kVideoRotation_0, interval_us_);
}
RTC_NOTREACHED() << "Invalid rotation value: " << static_cast<int>(rotation_);
RTC_DCHECK_NOTREACHED() << "Invalid rotation value: " << static_cast<int>(rotation_);
// Without this return, the Windows Visual Studio compiler complains
// "not all control paths return a value".
return GetFrame();
Expand Down
89 changes: 35 additions & 54 deletions deps/libwebrtc/pc/test/fake_audio_capture_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@

#include <string.h>

#include "api/make_ref_counted.h"
#include "api/units/time_delta.h"
#include "rtc_base/checks.h"
#include "rtc_base/location.h"
#include "rtc_base/ref_counted_object.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"

using ::webrtc::TimeDelta;

// Audio sample value that is high enough that it doesn't occur naturally when
// frames are being faked. E.g. NetEq will not generate this large sample value
// unless it has received an audio frame containing a sample of this value.
Expand All @@ -33,11 +35,6 @@ static const int kTotalDelayMs = 0;
static const int kClockDriftMs = 0;
static const uint32_t kMaxVolume = 14392;

enum {
MSG_START_PROCESS,
MSG_RUN_PROCESS,
};

FakeAudioCaptureModule::FakeAudioCaptureModule()
: audio_callback_(nullptr),
recording_(false),
Expand All @@ -47,9 +44,7 @@ FakeAudioCaptureModule::FakeAudioCaptureModule()
current_mic_level_(kMaxVolume),
started_(false),
next_frame_time_(0),
frames_received_(0) {
process_thread_checker_.Detach();
}
frames_received_(0) {}

FakeAudioCaptureModule::~FakeAudioCaptureModule() {
if (process_thread_) {
Expand All @@ -72,7 +67,7 @@ int FakeAudioCaptureModule::frames_received() const {

int32_t FakeAudioCaptureModule::ActiveAudioLayer(
AudioLayer* /*audio_layer*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -94,33 +89,33 @@ int32_t FakeAudioCaptureModule::Terminate() {
}

bool FakeAudioCaptureModule::Initialized() const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int16_t FakeAudioCaptureModule::PlayoutDevices() {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int16_t FakeAudioCaptureModule::RecordingDevices() {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::PlayoutDeviceName(
uint16_t /*index*/,
char /*name*/[webrtc::kAdmMaxDeviceNameSize],
char /*guid*/[webrtc::kAdmMaxGuidSize]) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::RecordingDeviceName(
uint16_t /*index*/,
char /*name*/[webrtc::kAdmMaxDeviceNameSize],
char /*guid*/[webrtc::kAdmMaxGuidSize]) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand Down Expand Up @@ -150,7 +145,7 @@ int32_t FakeAudioCaptureModule::SetRecordingDevice(
}

int32_t FakeAudioCaptureModule::PlayoutIsAvailable(bool* /*available*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -164,7 +159,7 @@ bool FakeAudioCaptureModule::PlayoutIsInitialized() const {
}

int32_t FakeAudioCaptureModule::RecordingIsAvailable(bool* /*available*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand Down Expand Up @@ -241,7 +236,7 @@ int32_t FakeAudioCaptureModule::InitSpeaker() {
}

bool FakeAudioCaptureModule::SpeakerIsInitialized() const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -251,40 +246,40 @@ int32_t FakeAudioCaptureModule::InitMicrophone() {
}

bool FakeAudioCaptureModule::MicrophoneIsInitialized() const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SpeakerVolumeIsAvailable(bool* /*available*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SetSpeakerVolume(uint32_t /*volume*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SpeakerVolume(uint32_t* /*volume*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::MaxSpeakerVolume(
uint32_t* /*max_volume*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::MinSpeakerVolume(
uint32_t* /*min_volume*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::MicrophoneVolumeIsAvailable(
bool* /*available*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -308,37 +303,37 @@ int32_t FakeAudioCaptureModule::MaxMicrophoneVolume(

int32_t FakeAudioCaptureModule::MinMicrophoneVolume(
uint32_t* /*min_volume*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SpeakerMuteIsAvailable(bool* /*available*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SetSpeakerMute(bool /*enable*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SpeakerMute(bool* /*enabled*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::MicrophoneMuteIsAvailable(bool* /*available*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::SetMicrophoneMute(bool /*enable*/) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

int32_t FakeAudioCaptureModule::MicrophoneMute(bool* /*enabled*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -357,7 +352,7 @@ int32_t FakeAudioCaptureModule::SetStereoPlayout(bool /*enable*/) {
}

int32_t FakeAudioCaptureModule::StereoPlayout(bool* /*enabled*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -376,7 +371,7 @@ int32_t FakeAudioCaptureModule::SetStereoRecording(bool enable) {
}

int32_t FakeAudioCaptureModule::StereoRecording(bool* /*enabled*/) const {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
return 0;
}

Expand All @@ -386,21 +381,6 @@ int32_t FakeAudioCaptureModule::PlayoutDelay(uint16_t* delay_ms) const {
return 0;
}

void FakeAudioCaptureModule::OnMessage(rtc::Message* msg) {
switch (msg->message_id) {
case MSG_START_PROCESS:
StartProcessP();
break;
case MSG_RUN_PROCESS:
ProcessFrameP();
break;
default:
// All existing messages should be caught. Getting here should never
// happen.
RTC_NOTREACHED();
}
}

bool FakeAudioCaptureModule::Initialize() {
// Set the send buffer samples high enough that it would not occur on the
// remote side unless a packet containing a sample of that magnitude has been
Expand Down Expand Up @@ -444,7 +424,7 @@ void FakeAudioCaptureModule::UpdateProcessing(bool start) {
process_thread_ = rtc::Thread::Create();
process_thread_->Start();
}
process_thread_->Post(RTC_FROM_HERE, this, MSG_START_PROCESS);
process_thread_->PostTask([this] { StartProcessP(); });
} else {
if (process_thread_) {
process_thread_->Stop();
Expand Down Expand Up @@ -490,7 +470,8 @@ void FakeAudioCaptureModule::ProcessFrameP() {
const int64_t current_time = rtc::TimeMillis();
const int64_t wait_time =
(next_frame_time_ > current_time) ? next_frame_time_ - current_time : 0;
process_thread_->PostDelayed(RTC_FROM_HERE, wait_time, this, MSG_RUN_PROCESS);
process_thread_->PostDelayedTask([this] { ProcessFrameP(); },
TimeDelta::Millis(wait_time));
}

void FakeAudioCaptureModule::ReceiveFrameP() {
Expand All @@ -506,7 +487,7 @@ void FakeAudioCaptureModule::ReceiveFrameP() {
kNumberOfChannels, kSamplesPerSecond,
rec_buffer_, nSamplesOut,
&elapsed_time_ms, &ntp_time_ms) != 0) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
RTC_CHECK(nSamplesOut == kNumberSamples);

Expand All @@ -532,7 +513,7 @@ void FakeAudioCaptureModule::SendFrameP() {
send_buffer_, kNumberSamples, kNumberBytesPerSample,
kNumberOfChannels, kSamplesPerSecond, kTotalDelayMs, kClockDriftMs,
current_mic_level, key_pressed, current_mic_level) != 0) {
RTC_NOTREACHED();
RTC_DCHECK_NOTREACHED();
}
current_mic_level_ = current_mic_level;
}
16 changes: 7 additions & 9 deletions deps/libwebrtc/pc/test/fake_audio_capture_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@
#include "api/sequence_checker.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_device/include/audio_device_defines.h"
#include "rtc_base/message_handler.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
#include "rtc_base/thread_message.h"

namespace rtc {
class Thread;
} // namespace rtc

class FakeAudioCaptureModule : public webrtc::AudioDeviceModule,
public rtc::MessageHandlerAutoCleanup {
class FakeAudioCaptureModule : public webrtc::AudioDeviceModule {
public:
typedef uint16_t Sample;

Expand Down Expand Up @@ -140,6 +136,10 @@ class FakeAudioCaptureModule : public webrtc::AudioDeviceModule,
int32_t EnableBuiltInNS(bool enable) override { return -1; }

int32_t GetPlayoutUnderrunCount() const override { return -1; }

absl::optional<webrtc::AudioDeviceModule::Stats> GetStats() const override {
return webrtc::AudioDeviceModule::Stats();
}
#if defined(WEBRTC_IOS)
int GetPlayoutAudioParameters(
webrtc::AudioParameters* params) const override {
Expand All @@ -152,9 +152,6 @@ class FakeAudioCaptureModule : public webrtc::AudioDeviceModule,

// End of functions inherited from webrtc::AudioDeviceModule.

// The following function is inherited from rtc::MessageHandler.
void OnMessage(rtc::Message* msg) override;

protected:
// The constructor is protected because the class needs to be created as a
// reference counted object (for memory managment reasons). It could be
Expand Down Expand Up @@ -232,7 +229,8 @@ class FakeAudioCaptureModule : public webrtc::AudioDeviceModule,
// Protects variables that are accessed from process_thread_ and
// the main thread.
mutable webrtc::Mutex mutex_;
webrtc::SequenceChecker process_thread_checker_;
webrtc::SequenceChecker process_thread_checker_{
webrtc::SequenceChecker::kDetached};
};

#endif // PC_TEST_FAKE_AUDIO_CAPTURE_MODULE_H_
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ class FrameGeneratorCapturerVideoTrackSource : public VideoTrackSource {

~FrameGeneratorCapturerVideoTrackSource() = default;

void Start() { SetState(kLive); }
void Start() {
SetState(kLive);
video_capturer_->Start();
}

void Stop() { SetState(kMuted); }
void Stop() {
SetState(kMuted);
video_capturer_->Stop();
}

bool is_screencast() const override { return is_screencast_; }

Expand Down
Loading