Files
ShakaPlayer/lib/msf/msf_sender.js
Álvaro Velad Galván 4f62ce8b24 build: Reduce bundle size by deduplicating license headers (#10182)
Ensure generated bundles contain a single license header instead of
repeating the same notice across bundled modules.

Normalize all copyright years to 2016 and remove
duplicate license headers from generated bundles.

This reduces the final bundle size while preserving license information
in the distributed artifacts.
2026-06-05 12:43:28 +02:00

54 lines
1.3 KiB
JavaScript

/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.msf.Sender');
goog.require('shaka.log');
goog.require('shaka.msf.BufferControlWriter');
goog.requireType('shaka.msf.Utils');
goog.requireType('shaka.msf.Writer');
shaka.msf.Sender = class {
/**
* @param {!shaka.msf.Writer} writer
* @param {!shaka.msf.Utils.Version} version
*/
constructor(writer, version) {
/** @private {!shaka.msf.Writer} */
this.writer_ = writer;
/** @private {!shaka.msf.Utils.Version} */
this.version_ = version;
}
/**
* @param {shaka.msf.Utils.ClientSetup} client
* @return {!Promise}
*/
async client(client) {
shaka.log.debug('Encoding client setup message:', client);
// Create a BufferControlWriter instance
const writer = new shaka.msf.BufferControlWriter(this.version_);
// Marshal the client setup message
writer.marshalClientSetup({
versions: client.versions,
params: client.params,
});
// Get the bytes from the writer
const bytes = writer.getBytes();
shaka.log.v1(`Client setup message created: ${bytes.length} bytes`);
// Write the entire message in a single operation
await this.writer_.write(bytes);
shaka.log.v1('Client setup message sent successfully');
}
};