Skip to content

Commit

Permalink
Merge branch 'release/18.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexa committed Dec 3, 2018
2 parents 49f732c + 3b222ce commit d52653f
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

## develop

## 18.10.2

- [ADD] 解像度を固定するオプションを追加する
- [FIX] WebSocket の分かれているべきフレームがくっついていたのを修正した

## 18.10.1

- [UPDATE] 利用している libwebrtc のライブラリを M71 にする
Expand Down
2 changes: 1 addition & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BUILD_NUMBER=$(shell date +"%Y%m%d%H%M%S")
WEBRTC_VERSION=71
MOMO_VERSION=18.10.1
MOMO_VERSION=18.10.2

TARGET=$@

Expand Down
2 changes: 0 additions & 2 deletions doc/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ $ make armv8 BUILD_MODE=pkg
```
$ git submodule status
da901cca542612a133efcb04e8e78080186991e4 libs/CLI11 (v1.6.1-8-gda901cc)
0f1b43536d97d9311c73b658b86a9d44be9e5e82 libs/civetweb (v1.10)
d2dd27dc3b8472dbaa7d66f83619b3ebcd9185fe libs/json (v3.1.2)
c6d7e295bf5a0ab9b5f896720cc1a0e0fdc397a7 libs/websocketpp (0.3.0-395-gc6d7e29)
```
13 changes: 10 additions & 3 deletions doc/USE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ $ sudo apt-get install libx11-6 libxau6 libxdmcp6 libxcb1 libnspr4 libexpat1 lib
- arm 系でも指定はできるようになっていますが、マシンリソースが足らず動作しません
- ロジクールの BRIO 4K 動作確認しています

### プレビュー版の機能

下記はプレビュー版の機能です

- --fixed-resolution 固定解像度

## 利用方法

Momo はモードを 2 つ持っています。一つが P2P モードで Momo 自体がシグナリングサーバの機能も持つモードです。
Expand All @@ -77,14 +83,14 @@ Momo はモードを 2 つ持っています。一つが P2P モードで Momo

```shell
$ momo --version
WebRTC Native Client Momo version 18.10.0
WebRTC Native Client Momo version 18.10.2
```

### P2P で動作を確認する

```shell
$ momo --no-audio --video-codec H264 --video-bitrate 800 \
p2p --port 8080
p2p --port 8080
```

http://[momo の IP アドレス]:8080/html/p2p.html にアクセスしてください。
Expand All @@ -102,7 +108,7 @@ $ momo --no-audio --video-codec VP8 --video-bitrate 500 \

```
$ ./momo --version
WebRTC Native Client Momo 18.10.0
WebRTC Native Client Momo 18.10.2
```

```
Expand All @@ -125,6 +131,7 @@ Options:
--resolution STR in [QVGA,VGA,HD,FHD,4K]
解像度
--framerate INT in [1 - 60] フレームレート
--fixed-resolution 固定解像度
--priority STR in [BALANCE,FRAMERATE,RESOLUTION]
優先設定
--daemon デーモン化する
Expand Down
2 changes: 2 additions & 0 deletions src/connection_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct ConnectionSettings
int audio_bitrate = 0;
std::string resolution = "VGA";
int framerate = 0;
bool fixed_resolution = false;
std::string priority = "BALANCE";

std::string sora_signaling_host = "wss://example.com/signaling";
Expand Down Expand Up @@ -72,6 +73,7 @@ struct ConnectionSettings
os << "audio_bitrate: " << cs.audio_bitrate << "\n";
os << "resolution: " << cs.resolution << "\n";
os << "framerate: " << cs.framerate << "\n";
os << "fixed_resolution: " << (cs.fixed_resolution ? "true" : "false") << "\n";
os << "priority: " << cs.priority << "\n";
os << "sora_signaling_host: " << cs.sora_signaling_host << "\n";
os << "sora_channel_id: " << cs.sora_channel_id << "\n";
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ int main(int argc, char* argv[])
app.add_option("--audio-bitrate", cs.audio_bitrate, "オーディオのビットレート")->check(CLI::Range(6, 510));
app.add_option("--resolution", cs.resolution, "解像度")->check(Enum({"QVGA", "VGA", "HD", "FHD", "4K"}));
app.add_option("--framerate", cs.framerate, "フレームレート")->check(CLI::Range(1, 60));
app.add_flag("--fixed-resolution", cs.fixed_resolution, "固定解像度");
app.add_option("--priority", cs.priority, "優先設定 (Experimental)")->check(Enum({"BALANCE", "FRAMERATE", "RESOLUTION"}));
app.add_flag("--daemon", is_daemon, "デーモン化する");
app.add_flag("--version", version, "バージョン情報の表示");
Expand Down
4 changes: 4 additions & 0 deletions src/rtc/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ std::shared_ptr<RTCConnection> RTCManager::createConnection(
_factory->CreateVideoTrack(Util::generateRundomChars(), _video_source));
if (video_track)
{
if (_conn_settings.fixed_resolution) {
video_track->set_content_hint(webrtc::VideoTrackInterface::ContentHint::kText);
}

rtc::scoped_refptr<webrtc::RtpSenderInterface> video_sender(
connection->CreateSender(webrtc::MediaStreamTrackInterface::kVideoKind, Util::generateRundomChars()));
webrtc::RtpParameters parameters = video_sender->GetParameters();
Expand Down
18 changes: 11 additions & 7 deletions src/ws/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ void Websocket::sendText(std::string text) {
void Websocket::doSendText(std::string text) {
RTC_LOG(LS_INFO) << __FUNCTION__ << ": " << text;

bool empty = write_buffer_.size() == 0;
bool empty = write_buffer_.empty();
boost::beast::flat_buffer buffer;

const auto n = boost::asio::buffer_copy(write_buffer_.prepare(text.size()), boost::asio::buffer(text));
write_buffer_.commit(n);
const auto n = boost::asio::buffer_copy(buffer.prepare(text.size()), boost::asio::buffer(text));
buffer.commit(n);

write_buffer_.push_back(std::move(buffer));

if (empty) {
doWrite();
Expand All @@ -103,10 +106,11 @@ void Websocket::doSendText(std::string text) {
void Websocket::doWrite() {
RTC_LOG(LS_INFO) << __FUNCTION__;

auto& buffer = write_buffer_.front();
if (isSSL()) {
wss_->text(true);
wss_->async_write(
write_buffer_.data(),
buffer.data(),
boost::asio::bind_executor(
strand_,
std::bind(
Expand All @@ -117,7 +121,7 @@ void Websocket::doWrite() {
} else {
ws_->text(true);
ws_->async_write(
write_buffer_.data(),
buffer.data(),
boost::asio::bind_executor(
strand_,
std::bind(
Expand All @@ -141,9 +145,9 @@ void Websocket::onWrite(boost::system::error_code ec, std::size_t bytes_transfer
if (ec)
return MOMO_BOOST_ERROR(ec, "onWrite");

write_buffer_.consume(bytes_transferred);
write_buffer_.erase(write_buffer_.begin());

if (write_buffer_.size() != 0)
if (!write_buffer_.empty())
{
doWrite();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ws/websocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Websocket : public std::enable_shared_from_this<Websocket>
boost::asio::strand<boost::asio::io_context::executor_type> strand_;

boost::beast::multi_buffer read_buffer_;
boost::beast::multi_buffer write_buffer_;
std::vector<boost::beast::flat_buffer> write_buffer_;

public:
// 非SSL
Expand Down

0 comments on commit d52653f

Please sign in to comment.