Hi, I don't think so. Why do you think it would be better?
Tomáš 2017-09-07 10:50 GMT+02:00 Frediano Ziglio <fzig...@redhat.com>: > > > > --- > > display.js | 26 ++++++++++++++++++++------ > > spiceconn.js | 2 ++ > > webm.js | 12 ++++++++++-- > > 3 files changed, 32 insertions(+), 8 deletions(-) > > > > diff --git a/display.js b/display.js > > index 0868f91..abd5b1a 100644 > > --- a/display.js > > +++ b/display.js > > @@ -543,7 +543,8 @@ SpiceDisplayConn.prototype.process_channel_message = > > function(msg) > > else > > this.streams[m.id] = m; > > > > - if (m.codec_type == SPICE_VIDEO_CODEC_TYPE_VP8) > > + if (m.codec_type == SPICE_VIDEO_CODEC_TYPE_VP8 || > > + m.codec_type == SPICE_VIDEO_CODEC_TYPE_VP9) > > { > > var media = new MediaSource(); > > var v = document.createElement("video"); > > @@ -606,7 +607,8 @@ SpiceDisplayConn.prototype.process_channel_message = > > function(msg) > > if (this.streams[m.base.id].codec_type === > > SPICE_VIDEO_CODEC_TYPE_MJPEG) > > process_mjpeg_stream_data(this, m, time_until_due); > > > > - if (this.streams[m.base.id].codec_type === > > SPICE_VIDEO_CODEC_TYPE_VP8) > > + if (this.streams[m.base.id].codec_type === > > SPICE_VIDEO_CODEC_TYPE_VP8 || > > + this.streams[m.base.id].codec_type === > > SPICE_VIDEO_CODEC_TYPE_VP9) > > process_video_stream_data(this.streams[m.base.id], m); > > > > return true; > > @@ -640,7 +642,8 @@ SpiceDisplayConn.prototype.process_channel_message = > > function(msg) > > var m = new SpiceMsgDisplayStreamDestroy(msg.data); > > STREAM_DEBUG > 0 && console.log(this.type + ": MsgStreamDestroy > id" > > + m.id); > > > > - if (this.streams[m.id].codec_type == > SPICE_VIDEO_CODEC_TYPE_VP8) > > + if (this.streams[m.id].codec_type == > SPICE_VIDEO_CODEC_TYPE_VP8 || > > + this.streams[m.id].codec_type == > SPICE_VIDEO_CODEC_TYPE_VP9) > > { > > document.getElementById(this.parent.screen_id).removeChild( > this.streams[m.id].video); > > this.streams[m.id].source_buffer = null; > > @@ -1036,14 +1039,24 @@ function handle_video_source_open(e) > > { > > var stream = this.stream; > > var p = this.spiceconn; > > + var codec_type; > > > > if (stream.source_buffer) > > return; > > > > - var s = this.addSourceBuffer(SPICE_VP8_CODEC); > > + if (this.stream.codec_type == SPICE_VIDEO_CODEC_TYPE_VP8) > > + { > > + codec_type = SPICE_VP8_CODEC; > > + } > > + else > > + { > > + codec_type = SPICE_VP9_CODEC; > > + } > > + > > Would not be better to use a switch ? > > > + var s = this.addSourceBuffer(codec_type); > > if (! s) > > { > > - p.log_err('Codec ' + SPICE_VP8_CODEC + ' not available.'); > > + p.log_err('Codec ' + codec_type + ' not available.'); > > return; > > } > > > > @@ -1054,7 +1067,8 @@ function handle_video_source_open(e) > > listen_for_video_events(stream); > > > > var h = new webm_Header(); > > - var te = new webm_VideoTrackEntry(this.stream.stream_width, > > this.stream.stream_height); > > + var te = new webm_VideoTrackEntry(this.stream.stream_width, > > this.stream.stream_height, > > + this.stream.codec_type); > > var t = new webm_Tracks(te); > > > > var mb = new ArrayBuffer(h.buffer_size() + t.buffer_size()) > > diff --git a/spiceconn.js b/spiceconn.js > > index 78d5820..4c7bcaf 100644 > > --- a/spiceconn.js > > +++ b/spiceconn.js > > @@ -147,6 +147,8 @@ SpiceConn.prototype = > > (1 << SPICE_DISPLAY_CAP_CODEC_MJPEG); > > if ('MediaSource' in window && > > MediaSource.isTypeSupported(SPICE_VP8_CODEC)) > > caps |= (1 << SPICE_DISPLAY_CAP_CODEC_VP8); > > + if ('MediaSource' in window && > > MediaSource.isTypeSupported(SPICE_VP9_CODEC)) > > + caps |= (1 << SPICE_DISPLAY_CAP_CODEC_VP9); > > msg.channel_caps.push(caps); > > } > > > > diff --git a/webm.js b/webm.js > > index 789da14..c697135 100644 > > --- a/webm.js > > +++ b/webm.js > > @@ -88,6 +88,7 @@ var EXPECTED_PACKET_DURATION = 10; > > var GAP_DETECTION_THRESHOLD = 50; > > > > var SPICE_VP8_CODEC = 'video/webm; > codecs="vp8"'; > > +var SPICE_VP9_CODEC = 'video/webm; > codecs="vp9"'; > > > > /*---------------------------------------------------------- > ------------------ > > ** EBML utility functions > > @@ -467,7 +468,7 @@ webm_AudioTrackEntry.prototype = > > }, > > } > > > > -function webm_VideoTrackEntry(width, height) > > +function webm_VideoTrackEntry(width, height, codec_type) > > { > > this.id = WEBM_TRACK_ENTRY; > > this.number = 1; > > @@ -482,8 +483,15 @@ function webm_VideoTrackEntry(width, height) > > this.codec_decode_all = 0; // fixme - check > > this.seek_pre_roll = 0; // 80000000; // fixme - check > > this.codec_delay = 80000000; // Must match codec_private.preskip > > - this.codec_id = "V_VP8"; > > this.video = new webm_Video(width, height); > > + if (codec_type == SPICE_VIDEO_CODEC_TYPE_VP8) > > + { > > + this.codec_id = "V_VP8"; > > + } > > + else > > + { > > + this.codec_id = "V_VP9"; > > + } > > } > > > > webm_VideoTrackEntry.prototype = > > Frediano >
_______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/spice-devel