Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [3.1.0-exp.9] - 2024-12-13

### Changed
- deps: use [email protected]
- doc: improve the API documentation of VideoCodecInfo
- doc: improve the API documentation of AudioCodecInfo
- doc: improve the API documentation of VideoStreamSender
- doc: improve the API documentation of VideoStreamReceiver
- doc: improve the API documentation of InputSender
- doc: improve the API documentation of InputReceiver
- doc: improve the API documentation of AudioStreamSender
- doc: improve the API documentation of AudioStreamReceiver
- doc: improve the API documentation of SignalingManager

## [3.1.0-exp.8] - 2023-11-30

### Changed

- Upgrade the version of WebRTC package `3.0.0-pre.7`.
  • Loading branch information
Unity Technologies committed Dec 13, 2024
1 parent 73473ae commit 645ee8f
Show file tree
Hide file tree
Showing 20 changed files with 593 additions and 224 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to com.unity.renderstreaming package will be documented in t
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [3.1.0-exp.9] - 2024-12-13

### Changed
- deps: use [email protected]
- doc: improve the API documentation of VideoCodecInfo
- doc: improve the API documentation of AudioCodecInfo
- doc: improve the API documentation of VideoStreamSender
- doc: improve the API documentation of VideoStreamReceiver
- doc: improve the API documentation of InputSender
- doc: improve the API documentation of InputReceiver
- doc: improve the API documentation of AudioStreamSender
- doc: improve the API documentation of AudioStreamReceiver
- doc: improve the API documentation of SignalingManager

## [3.1.0-exp.8] - 2023-11-30

### Changed

- Upgrade the version of WebRTC package `3.0.0-pre.7`.

## [3.1.0-exp.7] - 2023-08-09

### Added
Expand Down
2 changes: 1 addition & 1 deletion Editor/WebAppDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Unity.RenderStreaming.Editor
internal static class WebAppDownloader
{
const string URLRoot = "https://github.com/Unity-Technologies/UnityRenderStreaming";
const string LatestKnownVersion = "3.1.0-exp.7";
const string LatestKnownVersion = "3.1.0-exp.8";

// TODO::fix release process of webserver runtime.
const string FileNameWebAppForMac = "webserver_mac";
Expand Down
51 changes: 29 additions & 22 deletions Runtime/Scripts/AudioCodecInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Unity.RenderStreaming
{
/// <summary>
///
/// Represents information about an audio codec, including its MIME type, SDP format parameters, channel count, and sample rate.
/// </summary>
[Serializable]
public class AudioCodecInfo : IEquatable<AudioCodecInfo>
Expand All @@ -20,27 +20,27 @@ public class AudioCodecInfo : IEquatable<AudioCodecInfo>
private int m_SampleRate;

/// <summary>
///
/// Gets the name of the audio codec.
/// </summary>
public string name { get { return m_MimeType.GetCodecName(); } }

/// <summary>
///
/// Gets the MIME type of the audio codec.
/// </summary>
public string mimeType { get { return m_MimeType; } }

/// <summary>
///
/// Gets the number of audio channels.
/// </summary>
public int channelCount { get { return m_ChannelCount; } }

/// <summary>
///
/// Gets the sample rate of the audio.
/// </summary>
public int sampleRate { get { return m_SampleRate; } }

/// <summary>
///
/// Gets the SDP format parameters line.
/// </summary>
public string sdpFmtpLine { get { return m_SdpFmtpLine; } }

Expand All @@ -50,10 +50,17 @@ static internal AudioCodecInfo Create(RTCRtpCodecCapability caps)
}

/// <summary>
///
/// Determines whether the specified <see cref="AudioCodecInfo"/> is equal to the current <see cref="AudioCodecInfo"/>.
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
/// <example>
/// <code>
/// <![CDATA[
/// Debug.Log(audioStreamReceiver1.codec.Equals(audioStreamReceiver2.codec));
/// ]]>
///</code>
/// </example>
/// <param name="other">The <see cref="AudioCodecInfo"/> to compare with the current <see cref="AudioCodecInfo"/>.</param>
/// <returns>true if the specified <see cref="AudioCodecInfo"/> is equal to the current <see cref="AudioCodecInfo"/>; otherwise, false.</returns>
public bool Equals(AudioCodecInfo other)
{
if (other == null)
Expand All @@ -65,30 +72,30 @@ public bool Equals(AudioCodecInfo other)
}

/// <summary>
///
/// Determines whether the specified object is equal to the current <see cref="AudioCodecInfo"/>.
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
/// <param name="obj">The object to compare with the current <see cref="AudioCodecInfo"/>.</param>
/// <returns>true if the specified object is equal to the current <see cref="AudioCodecInfo"/>; otherwise, false.</returns>
public override bool Equals(object obj)
{
return obj is AudioCodecInfo ? Equals((AudioCodecInfo)obj) : base.Equals(obj);
}

/// <summary>
///
/// Returns a hash code for the <see cref="AudioCodecInfo"/>.
/// </summary>
/// <returns></returns>
/// <returns>A hash code for the current <see cref="AudioCodecInfo"/>.</returns>
public override int GetHashCode()
{
return new { mimeType, sdpFmtpLine, channelCount, sampleRate }.GetHashCode();
}

/// <summary>
///
/// Determines whether two specified instances of <see cref="AudioCodecInfo"/> are equal.
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
/// <param name="left">The first <see cref="AudioCodecInfo"/> to compare.</param>
/// <param name="right">The second <see cref="AudioCodecInfo"/> to compare.</param>
/// <returns>true if the two <see cref="AudioCodecInfo"/> instances are equal; otherwise, false.</returns>
public static bool operator ==(AudioCodecInfo left, AudioCodecInfo right)
{
if (ReferenceEquals(left, null))
Expand All @@ -102,11 +109,11 @@ public override int GetHashCode()
}

/// <summary>
///
/// Determines whether two specified instances of <see cref="AudioCodecInfo"/> are not equal.
/// </summary>
/// <param name="left"></param>
/// <param name="right"></param>
/// <returns></returns>
/// <param name="left">The first <see cref="AudioCodecInfo"/> to compare.</param>
/// <param name="right">The second <see cref="AudioCodecInfo"/> to compare.</param>
/// <returns>true if the two <see cref="AudioCodecInfo"/> instances are not equal; otherwise, false.</returns>
public static bool operator !=(AudioCodecInfo left, AudioCodecInfo right)
{
return !(left == right);
Expand Down
36 changes: 26 additions & 10 deletions Runtime/Scripts/AudioStreamReceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@
namespace Unity.RenderStreaming
{
/// <summary>
///
/// AudioStreamReceiver is a component that receives audio streams and plays them through a specified AudioSource.
/// </summary>
/// <seealso cref="AudioCodecInfo"/>
[AddComponentMenu("Render Streaming/Audio Stream Receiver")]
public class AudioStreamReceiver : StreamReceiverBase
{
internal const string CodecPropertyName = nameof(m_Codec);
internal const string TargetAudioSourcePropertyName = nameof(m_TargetAudioSource);

/// <summary>
///
/// Delegate for handling updates to the received audio source.
/// </summary>
/// <param name="source"></param>
/// <param name="source">The updated AudioSource.</param>
public delegate void OnUpdateReceiveAudioSourceHandler(AudioSource source);

/// <summary>
///
/// Event triggered when the received audio source is updated.
/// </summary>
public OnUpdateReceiveAudioSourceHandler OnUpdateReceiveAudioSource;

Expand All @@ -33,15 +34,15 @@ public class AudioStreamReceiver : StreamReceiverBase
private AudioCodecInfo m_Codec;

/// <summary>
///
/// Gets the codec information for the audio stream.
/// </summary>
public AudioCodecInfo codec
{
get { return m_Codec; }
}

/// <summary>
///
/// Gets or sets the target AudioSource where the received audio will be played.
/// </summary>
public AudioSource targetAudioSource
{
Expand All @@ -50,9 +51,15 @@ public AudioSource targetAudioSource
}

/// <summary>
///
/// Gets the available audio codecs.
/// </summary>
/// <returns></returns>
/// <code>
/// var codecs = AudioStreamReceiver.GetAvailableCodecs();
/// foreach (var codec in codecs)
/// Debug.Log(codec.name);
/// </code>
/// </example>
/// <returns>A list of available codecs.</returns>
static public IEnumerable<AudioCodecInfo> GetAvailableCodecs()
{
var excludeCodecMimeType = new[] { "audio/CN", "audio/telephone-event" };
Expand All @@ -61,9 +68,18 @@ static public IEnumerable<AudioCodecInfo> GetAvailableCodecs()
}

/// <summary>
///
/// Sets the codec for the audio stream.
/// </summary>
/// <param name="mimeType"></param>
/// <example>
/// <code>
/// <![CDATA[
/// var codec = AudioStreamReceiver.GetAvailableCodecs().FirstOrDefault(x => x.mimeType.Contains("opus"));
/// audioStreamReceiver.SetCodec(codec);
/// ]]>
///</code>
/// </example>
/// <param name="codec">The codec information to set.</param>
/// <exception cref="InvalidOperationException">Thrown if the transceiver is streaming or the track has ended.</exception>
public void SetCodec(AudioCodecInfo codec)
{
m_Codec = codec;
Expand Down
Loading

0 comments on commit 645ee8f

Please sign in to comment.