Skip to content

[flutter_webrtc] Update flutter_webrtc to 0.9.23 #530

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

Merged
merged 3 commits into from
Mar 27, 2023
Merged
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
5 changes: 5 additions & 0 deletions packages/flutter_webrtc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.1.1

* Update flutter_webrtc to 0.9.23.
* Fix coredump issue when exit app.

## 0.1.0

* Initial release.
4 changes: 2 additions & 2 deletions packages/flutter_webrtc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ For other Tizen devices :

```yaml
dependencies:
flutter_webrtc: ^0.9.18
flutter_webrtc_tizen: ^0.1.0
flutter_webrtc: ^0.9.23
flutter_webrtc_tizen: ^0.1.1
```

## Functionality
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
cupertino_icons: ^1.0.3
flutter:
sdk: flutter
flutter_webrtc: ^0.9.18
flutter_webrtc: ^0.9.23
flutter_webrtc_tizen:
path: ../../
http: ^0.13.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies:
flutter:
sdk: flutter
flutter_background: ^1.0.0
flutter_webrtc: ^0.9.18
flutter_webrtc: ^0.9.23
flutter_webrtc_tizen:
path: ../../
# Required for MediaRecorder example
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_webrtc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: flutter_webrtc_tizen
homepage: https://github.com/flutter-tizen/plugins
description: Flutter WebRTC plugin for Tizen, based on GoogleWebRTC.
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/flutter_webrtc
version: 0.1.0
version: 0.1.1

flutter:
plugin:
Expand Down
33 changes: 17 additions & 16 deletions packages/flutter_webrtc/tizen/inc/flutter_peerconnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class FlutterPeerConnection {
std::unique_ptr<MethodResultProxy> result);

void GetRemoteDescription(RTCPeerConnection* pc,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

scoped_refptr<RTCRtpTransceiverInit> mapToRtpTransceiverInit(
const EncodableMap& transceiverInit);
Expand All @@ -89,56 +89,57 @@ class FlutterPeerConnection {
void AddTransceiver(RTCPeerConnection* pc, const std::string& trackId,
const std::string& mediaType,
const EncodableMap& transceiverInit,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void GetTransceivers(RTCPeerConnection* pc,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void GetReceivers(RTCPeerConnection* pc,
std::unique_ptr<MethodResultProxy> resulte);

void RtpSenderDispose(RTCPeerConnection* pc, std::string rtpSenderId,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void RtpSenderSetTrack(RTCPeerConnection* pc, RTCMediaTrack* track,
std::string rtpSenderId,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void RtpSenderReplaceTrack(RTCPeerConnection* pc, RTCMediaTrack* track,
std::string rtpSenderId,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

scoped_refptr<RTCRtpParameters> updateRtpParameters(
EncodableMap newParameters, scoped_refptr<RTCRtpParameters> parameters);

void RtpSenderSetParameters(RTCPeerConnection* pc, std::string rtpSenderId,
const EncodableMap& parameters,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void RtpTransceiverStop(RTCPeerConnection* pc, std::string rtpTransceiverId,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void RtpTransceiverGetCurrentDirection(
RTCPeerConnection* pc, std::string rtpTransceiverId,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void SetConfiguration(RTCPeerConnection* pc,
const EncodableMap& configuration,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void CaptureFrame(RTCVideoTrack* track, std::string path,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

scoped_refptr<RTCRtpTransceiver> getRtpTransceiverById(RTCPeerConnection* pc,
std::string id);

void RtpTransceiverSetDirection(RTCPeerConnection* pc,
std::string rtpTransceiverId,
std::string direction,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void RtpTransceiverSetCodecPreferences(
RTCPeerConnection* pc, std::string rtpTransceiverId,
const EncodableList codecs, std::unique_ptr<MethodResultProxy> result);

void GetSenders(RTCPeerConnection* pc,
std::unique_ptr<MethodResultProxy> resulte);
std::unique_ptr<MethodResultProxy> result);

void AddIceCandidate(RTCIceCandidate* candidate, RTCPeerConnection* pc,
std::unique_ptr<MethodResultProxy> result);
Expand Down
Binary file modified packages/flutter_webrtc/tizen/lib/aarch64/libwebrtc.so
Binary file not shown.
Binary file modified packages/flutter_webrtc/tizen/lib/armel/libwebrtc.so
Binary file not shown.
Binary file modified packages/flutter_webrtc/tizen/lib/i586/libwebrtc.so
Binary file not shown.
4 changes: 2 additions & 2 deletions packages/flutter_webrtc/tizen/src/flutter_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class MethodCallProxyImpl : public MethodCallProxy {
public:
MethodCallProxyImpl(const MethodCall& method_call)
explicit MethodCallProxyImpl(const MethodCall& method_call)
: method_call_(method_call) {}

~MethodCallProxyImpl() {}
Expand All @@ -34,7 +34,7 @@ std::unique_ptr<MethodCallProxy> MethodCallProxy::Create(

class MethodResultProxyImpl : public MethodResultProxy {
public:
MethodResultProxyImpl(std::unique_ptr<MethodResult> method_result)
explicit MethodResultProxyImpl(std::unique_ptr<MethodResult> method_result)
: method_result_(std::move(method_result)) {}
~MethodResultProxyImpl() {}

Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_webrtc/tizen/src/flutter_media_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ void FlutterMediaStream::GetSources(std::unique_ptr<MethodResultProxy> result) {
EncodableList sources;

int nb_audio_devices = base_->audio_device_->RecordingDevices();
char strNameUTF8[128];
char strGuidUTF8[128];
char strNameUTF8[RTCAudioDevice::kAdmMaxDeviceNameSize + 1] = {0};
char strGuidUTF8[RTCAudioDevice::kAdmMaxGuidSize + 1] = {0};

for (uint16_t i = 0; i < nb_audio_devices; i++) {
base_->audio_device_->RecordingDeviceName(i, strNameUTF8, strGuidUTF8);
Expand Down
70 changes: 45 additions & 25 deletions packages/flutter_webrtc/tizen/src/flutter_peerconnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ EncodableMap rtpParametersToMap(
map[EncodableValue("minBitrate")] =
EncodableValue(encoding->min_bitrate_bps());
map[EncodableValue("maxFramerate")] =
EncodableValue(encoding->max_framerate());
EncodableValue(static_cast<int>(encoding->max_framerate()));
map[EncodableValue("scaleResolutionDownBy")] =
EncodableValue(encoding->scale_resolution_down_by());
map[EncodableValue("ssrc")] = EncodableValue((int)encoding->ssrc());
map[EncodableValue("ssrc")] =
EncodableValue(static_cast<int>(encoding->ssrc()));
encodings_info.push_back(EncodableValue(map));
}
info[EncodableValue("encodings")] = EncodableValue(encodings_info);
Expand Down Expand Up @@ -519,27 +520,13 @@ void FlutterPeerConnection::GetReceivers(
result_ptr->Success(EncodableValue(map));
}

void FlutterPeerConnection::RtpSenderDispose(
RTCPeerConnection* pc, std::string rtpSenderId,
std::unique_ptr<MethodResultProxy> result) {
std::shared_ptr<MethodResultProxy> result_ptr(result.release());

auto sender = GetRtpSenderById(pc, rtpSenderId);
if (nullptr == sender.get()) {
result_ptr->Error("rtpSenderDispose", "sender is null");
return;
}
// TODO RtpSenderDispose
result_ptr->Success();
}

void FlutterPeerConnection::RtpSenderSetTrack(
RTCPeerConnection* pc, RTCMediaTrack* track, std::string rtpSenderId,
std::unique_ptr<MethodResultProxy> result) {
std::shared_ptr<MethodResultProxy> result_ptr(result.release());
auto sender = GetRtpSenderById(pc, rtpSenderId);
if (nullptr == sender.get()) {
result_ptr->Error("rtpSenderDispose", "sender is null");
result_ptr->Error("rtpSenderSetTrack", "sender is null");
return;
}
sender->set_track(track);
Expand All @@ -552,7 +539,7 @@ void FlutterPeerConnection::RtpSenderReplaceTrack(
std::shared_ptr<MethodResultProxy> result_ptr(result.release());
auto sender = GetRtpSenderById(pc, rtpSenderId);
if (nullptr == sender.get()) {
result_ptr->Error("rtpSenderDispose", "sender is null");
result_ptr->Error("rtpSenderReplaceTrack", "sender is null");
return;
}

Expand Down Expand Up @@ -611,15 +598,17 @@ void FlutterPeerConnection::RtpSenderSetParameters(

auto sender = GetRtpSenderById(pc, rtpSenderId);
if (nullptr == sender.get()) {
result_ptr->Error("rtpSenderDispose", "sender is null");
result_ptr->Error("rtpSenderSetParameters", "sender is null");
return;
}

auto param = sender->parameters();
param = updateRtpParameters(parameters, param);
sender->set_parameters(param);
bool success = sender->set_parameters(param);

result_ptr->Success();
EncodableMap map;
map[EncodableValue("result")] = EncodableValue(success);
result_ptr->Success(EncodableValue(map));
}

void FlutterPeerConnection::RtpTransceiverStop(
Expand Down Expand Up @@ -703,6 +692,35 @@ void FlutterPeerConnection::RtpTransceiverSetDirection(
}
}

void FlutterPeerConnection::RtpTransceiverSetCodecPreferences(
RTCPeerConnection* pc, std::string rtpTransceiverId,
const EncodableList codecs, std::unique_ptr<MethodResultProxy> result) {
std::shared_ptr<MethodResultProxy> result_ptr(result.release());
auto transceiver = getRtpTransceiverById(pc, rtpTransceiverId);
if (nullptr == transceiver.get()) {
result_ptr->Error("RtpTransceiverSetCodecPreferences",
" transceiver is null ");
return;
}
std::vector<scoped_refptr<RTCRtpCodecCapability>> codecList;
for (auto codec : codecs) {
auto codecMap = GetValue<EncodableMap>(codec);
auto codecMimeType = findString(codecMap, "mimeType");
auto codecClockRate = findInt(codecMap, "clockRate");
auto codecNumChannels = findInt(codecMap, "channels");
auto codecSdpFmtpLine = findString(codecMap, "sdpFmtpLine");
auto codecCapability = RTCRtpCodecCapability::Create();
if (codecSdpFmtpLine != std::string())
codecCapability->set_sdp_fmtp_line(codecSdpFmtpLine);
codecCapability->set_clock_rate(codecClockRate);
if (codecNumChannels != -1) codecCapability->set_channels(codecNumChannels);
codecCapability->set_mime_type(codecMimeType);
codecList.push_back(codecCapability);
}
transceiver->SetCodecPreferences(codecList);
result_ptr->Success();
}

void FlutterPeerConnection::GetSenders(
RTCPeerConnection* pc, std::unique_ptr<MethodResultProxy> result) {
std::shared_ptr<MethodResultProxy> result_ptr(result.release());
Expand Down Expand Up @@ -732,7 +750,7 @@ EncodableMap statsToMap(const scoped_refptr<MediaRTCStats>& stats) {
report_map[EncodableValue("type")] =
EncodableValue(stats->type().std_string());
report_map[EncodableValue("timestamp")] =
EncodableValue(double(stats->timestamp_us()));
EncodableValue(static_cast<double>(stats->timestamp_us()));
EncodableMap values;
auto members = stats->Members();
for (int i = 0; i < members.size(); i++) {
Expand Down Expand Up @@ -782,7 +800,7 @@ void FlutterPeerConnection::GetStats(
std::unique_ptr<MethodResultProxy> result) {
std::shared_ptr<MethodResultProxy> result_ptr(result.release());
scoped_refptr<RTCMediaTrack> track = base_->MediaTracksForId(track_id);
if (track != nullptr) {
if (track != nullptr && track_id != "") {
bool found = false;
auto receivers = pc->receivers();
for (auto receiver : receivers.std_vector()) {
Expand Down Expand Up @@ -885,13 +903,15 @@ void FlutterPeerConnection::AddTrack(
streamids.push_back(item.c_str());
}
if (0 == kind.compare("audio")) {
auto sender = pc->AddTrack((RTCAudioTrack*)track.get(), streamids);
auto sender =
pc->AddTrack(reinterpret_cast<RTCVideoTrack*>(track.get()), streamids);
if (sender.get() != nullptr) {
result_ptr->Success(EncodableValue(rtpSenderToMap(sender)));
return;
}
} else if (0 == kind.compare("video")) {
auto sender = pc->AddTrack((RTCVideoTrack*)track.get(), streamids);
auto sender =
pc->AddTrack(reinterpret_cast<RTCVideoTrack*>(track.get()), streamids);
if (sender.get() != nullptr) {
result_ptr->Success(EncodableValue(rtpSenderToMap(sender)));
return;
Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_webrtc/tizen/src/flutter_video_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ const FlutterDesktopPixelBuffer* FlutterVideoRenderer::CopyPixelBuffer(
}

frame_->ConvertToARGB(RTCVideoFrame::Type::kABGR, rgb_buffer_.get(), 0,
(int)pixel_buffer_->width,
(int)pixel_buffer_->height);
static_cast<int>(pixel_buffer_->width),
static_cast<int>(pixel_buffer_->height));

pixel_buffer_->buffer = rgb_buffer_.get();
mutex_.unlock();
Expand Down Expand Up @@ -158,4 +158,4 @@ void FlutterVideoRendererManager::VideoRendererDispose(
"VideoRendererDispose() texture not found!");
}

} // namespace flutter_webrtc_plugin
} // namespace flutter_webrtc_plugin
Loading