diff options
author | Jeremy White <jwhite@codeweavers.com> | 2016-09-28 10:01:43 -0500 |
---|---|---|
committer | Jeremy White <jwhite@codeweavers.com> | 2016-10-10 11:29:57 -0500 |
commit | dd3fb12678b1769ce3f299b3c4b813bf0bd4dfdd (patch) | |
tree | e80dd552968fee75696b6e467226b4fea53bda44 | |
parent | b474c300a8da07b868235c490882f5af050620a0 (diff) |
If MediaSource is not available, do not report the vp8 or opus caps.
-rw-r--r-- | spiceconn.js | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/spiceconn.js b/spiceconn.js index 9651b47..33e7388 100644 --- a/spiceconn.js +++ b/spiceconn.js @@ -127,21 +127,28 @@ SpiceConn.prototype = ); if (msg.channel_type == SPICE_CHANNEL_PLAYBACK) - msg.channel_caps.push( - (1 << SPICE_PLAYBACK_CAP_OPUS) - ); + { + var caps = 0; + if ('MediaSource' in window && MediaSource.isTypeSupported(SPICE_PLAYBACK_CODEC)) + caps |= (1 << SPICE_PLAYBACK_CAP_OPUS); + msg.channel_caps.push(caps); + } else if (msg.channel_type == SPICE_CHANNEL_MAIN) + { msg.channel_caps.push( (1 << SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS) ); + } else if (msg.channel_type == SPICE_CHANNEL_DISPLAY) - msg.channel_caps.push( - (1 << SPICE_DISPLAY_CAP_SIZED_STREAM) | - (1 << SPICE_DISPLAY_CAP_STREAM_REPORT) | - (1 << SPICE_DISPLAY_CAP_MULTI_CODEC) | - (1 << SPICE_DISPLAY_CAP_CODEC_MJPEG) | - (1 << SPICE_DISPLAY_CAP_CODEC_VP8) - ); + { + var caps = (1 << SPICE_DISPLAY_CAP_SIZED_STREAM) | + (1 << SPICE_DISPLAY_CAP_STREAM_REPORT) | + (1 << SPICE_DISPLAY_CAP_MULTI_CODEC) | + (1 << SPICE_DISPLAY_CAP_CODEC_MJPEG); + if ('MediaSource' in window && MediaSource.isTypeSupported(SPICE_VP8_CODEC)) + caps |= (1 << SPICE_DISPLAY_CAP_CODEC_VP8); + msg.channel_caps.push(caps); + } hdr.size = msg.buffer_size(); |