• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

コミットメタ情報

リビジョン7d98aa7e9f360169e62c957460ef177822fb7303 (tree)
日時2017-03-30 21:02:02
作者dyknon <dyknon@user...>
コミッターdyknon

ログメッセージ

再生速度で同期する気がする

変更サマリ

差分

--- a/live.pl
+++ b/live.pl
@@ -111,6 +111,8 @@ if(!$ENV{QUERY_STRING}){
111111 }
112112 this.sindex = resp.key;
113113 this.cindex = resp.key;
114+ this.cache_len = resp.buflen / 1000;
115+ this.skip_delay = this.cache_len*2;
114116 this.nexcb = this.datacb;
115117 this.request("head", null);
116118 this.statbox.textContent = "loading video header";
@@ -279,19 +281,19 @@ if($con){
279281 $num = $args{n};
280282 }
281283 $con->send("i".pack("Q", $num), 0);
282- $con->recv($buf, 8*4+1, 0);
283- my ($cnum, $size, $pos, $cpos, $flags) = unpack("QQQQC", $buf);
284+ $con->recv($buf, 8*4+4+1, 0);
285+ my ($cnum, $size, $pos, $cpos, $buf_len, $flags) = unpack("QQQQLC", $buf);
284286 send_json({status=>"ok", num=>$cnum, size=>$size,
285- pos=>$pos, cpos=>$cpos, flags=>$flags});
287+ pos=>$pos, cpos=>$cpos, buflen=>$buf_len, flags=>$flags});
286288 }elsif($args{req} eq "key"){
287289 $con->send("k", 0);
288290 $con->recv($buf, 8, 0);
289291 my $num = unpack("Q", $buf);
290292 $con->send("i".pack("Q", $num), 0);
291- $con->recv($buf, 8*4+1, 0);
292- my ($cnum, $size, $pos, $cpos, $flags) = unpack("QQQQC", $buf);
293+ $con->recv($buf, 8*4+4+1, 0);
294+ my ($cnum, $size, $pos, $cpos, $buf_len, $flags) = unpack("QQQQLC", $buf);
293295 send_json({status=>"ok", key=>$num, num=>$cnum, size=>$size,
294- pos=>$pos, cpos=>$cpos, flags=>$flags});
296+ pos=>$pos, cpos=>$cpos, buflen=>$buf_len, flags=>$flags});
295297 }elsif($args{req} eq "head"){
296298 if(defined($args{n})){
297299 if($args{n} =~ /^[0-9]+$/){
@@ -340,8 +342,8 @@ if($con){
340342 }elsif($args{n} =~ /^[0-9]+$/){
341343 $num = $args{n};
342344 $con->send("i".pack("Q", $num), 0);
343- $con->recv($buf, 8*4+1, 0);
344- my ($cnum, $size, $pos, $cpos, $flags) = unpack("QQQQC", $buf);
345+ $con->recv($buf, 8*4+4+1, 0);
346+ my ($cnum, $size, $pos, $cpos, $buf_len, $flags) = unpack("QQQQLC", $buf);
345347 if(!($flags & 0x01)){
346348 goto IF_BAD_REQ;
347349 }
--- a/unixsock_mediaserver.pl
+++ b/unixsock_mediaserver.pl
@@ -33,6 +33,7 @@ use IO::Socket::UNIX;
3333 use IO::Select;
3434
3535 my $sockpath = $ENV{HOME}."/socks/media_server.sock";
36+our $buf_len = 5000;
3637
3738 $| = 1;
3839 $SIG{PIPE} = "IGNORE";
@@ -573,8 +574,8 @@ sub read{
573574 if($cluster_num){
574575 $cpos = int($clusters{$cluster_num-1}{time} * 1000);
575576 }
576- $self->{wbuf} = pack("QQQQC",
577- $cluster_num, $sum, $pos, $cpos, $flags);
577+ $self->{wbuf} = pack("QQQQLC",
578+ $cluster_num, $sum, $pos, $cpos, $buf_len, $flags);
578579 }
579580 }
580581 }else{
@@ -662,7 +663,7 @@ my $in_handle = new IO::Pipe;
662663 #$in_handle->reader(qw{ffmpeg -loglevel panic -f video4linux2 -r:v 10 -s vga -i /dev/video0 -map 0:v -c:v vp8 -deadline:v good -cpu-used:v 16 -g:v 10 -q:v 25 -qmax:v 28 -pix_fmt yuv420p -live 1 -vf realtime -cluster_size_limit 10000000 -cluster_time_limit 1000000 -f webm -});
663664 #$in_handle->reader(qw{ffmpeg -loglevel panic -s 1366x768 -r:v 20 -f x11grab -i :0+1080,880 -map 0:v -c:v vp8 -deadline:v good -cpu-used:v 8 -g:v 10 -q:v 25 -qmax:v 28 -pix_fmt yuv420p -live 1 -cluster_size_limit 10000000 -cluster_time_limit 1000000 -s wvga -vf realtime -f webm -});
664665 defined($ARGV[0]) || die;
665-$in_handle->reader(qw{ffmpeg -loglevel panic -i}, $ARGV[0], qw{-map 0:v:0 -map 0:a:0 -c:v vp8 -deadline:v realtime -cpu-used:v 8 -g:v 20 -q:v 28 -qmax:v 30 -live 1 -vf realtime -c:a libvorbis -ac 2 -ar 44.1k -b:a 64k -cluster_size_limit 10000000 -cluster_time_limit 1000000 -s wvga -f webm -});
666+$in_handle->reader(qw{ffmpeg -loglevel panic -i}, $ARGV[0], qw{-map 0:v:0 -map 0:a:0 -c:v vp8 -deadline:v realtime -cpu-used:v 8 -g:v 20 -q:v 24 -qmax:v 28 -live 1 -vf realtime -c:a libvorbis -ac 2 -ar 44.1k -b:a 64k -cluster_size_limit 10000000 -cluster_time_limit 1000000 -s wvga -f webm -});
666667 binmode($in_handle, ":raw");
667668 StreamInHandler->new($in_handle);
668669