Skip to content

Commit

Permalink
[d16-8] [Bug] AVAudioSourceNodeRenderHandler delegate is incorrectly …
Browse files Browse the repository at this point in the history
…bound (dotnet#9624)


Co-authored-by: Whitney Schmidt <[email protected]>
  • Loading branch information
monojenkins and whitneyschmidt authored Sep 15, 2020
1 parent 8318026 commit 5c06bdd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
27 changes: 23 additions & 4 deletions src/AVFoundation/AVCompat.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Copyright 2014-2016 Xamarin Inc. All rights reserved.

#if !WATCH

using System;
using System.ComponentModel;
using OpenTK;
Expand All @@ -10,6 +8,28 @@
using ObjCRuntime;

namespace AVFoundation {
#if !XAMCORE_4_0
public delegate int AVAudioSourceNodeRenderHandler (bool isSilence, AudioToolbox.AudioTimeStamp timestamp, uint frameCount, ref AudioToolbox.AudioBuffers outputData);

partial class AVAudioNode {
internal AVAudioNode() {}
}

partial class AVAudioSourceNode {
[Obsolete("Use 'AVAudioSourceNode (AVAudioSourceNodeRenderHandler2)' instead.")]
public AVAudioSourceNode (AVAudioSourceNodeRenderHandler renderHandler)
{
throw new InvalidOperationException ("Do not use this constructor. Use the 'AVAudioSourceNode (AVAudioSourceNodeRenderHandler2)' constructor instead.");
}

[Obsolete("Use 'AVAudioSourceNode (AVAudioFormat, AVAudioSourceNodeRenderHandler2)' instead.")]
public AVAudioSourceNode (AVAudioFormat format, AVAudioSourceNodeRenderHandler renderHandler)
{
throw new InvalidOperationException ("Do not use this constructor. Use the 'AVAudioSourceNode (AVAudioFormat, AVAudioSourceNodeRenderHandler2)' constructor instead.");
}
}
#endif // !XAMCORE_4_0
#if !WATCH
#if MONOMAC && !XAMCORE_4_0
[Obsolete ("This API is not available on this platform.")]
public partial class AVCaptureDataOutputSynchronizer : NSObject
Expand Down Expand Up @@ -496,6 +516,5 @@ public AVAssetDownloadTask GetAssetDownloadTask (AVUrlAsset urlAsset, string tit

#endif // TVOS
#endif // !XAMCORE_4_0
#endif // !WATCH
}

#endif
17 changes: 14 additions & 3 deletions src/avfoundation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13512,20 +13512,31 @@ interface AVCompositionTrackFormatDescriptionReplacement : NSSecureCoding {
[Export ("replacementFormatDescription")]
CMFormatDescription ReplacementFormatDescription { get; }
}

delegate /* OSStatus */ int AVAudioSourceNodeRenderHandler (bool isSilence, AudioTimeStamp timestamp, uint frameCount, ref AudioBuffers outputData);

#if XAMCORE_4_0
delegate /* OSStatus */ int AVAudioSourceNodeRenderHandler (ref bool isSilence, ref AudioTimeStamp timestamp, uint frameCount, ref AudioBuffers outputData);
#else
delegate /* OSStatus */ int AVAudioSourceNodeRenderHandler (bool isSilence, AudioToolbox.AudioTimeStamp timestamp, uint frameCount, ref AudioBuffers outputData);
delegate /* OSStatus */ int AVAudioSourceNodeRenderHandler2 (ref bool isSilence, ref AudioTimeStamp timestamp, uint frameCount, ref AudioBuffers outputData);
#endif
[Watch (6,0), TV (13,0), Mac (10,15), iOS (13,0)]
[BaseType (typeof(AVAudioNode))]
[DisableDefaultCtor]
interface AVAudioSourceNode : AVAudioMixing {
[Export ("initWithRenderBlock:")]
[DesignatedInitializer]
#if XAMCORE_4_0
IntPtr Constructor (AVAudioSourceNodeRenderHandler renderHandler);
#else
IntPtr Constructor (AVAudioSourceNodeRenderHandler2 renderHandler);
#endif

[Export ("initWithFormat:renderBlock:")]
[DesignatedInitializer]
#if XAMCORE_4_0
IntPtr Constructor (AVAudioFormat format, AVAudioSourceNodeRenderHandler renderHandler);
#else
IntPtr Constructor (AVAudioFormat format, AVAudioSourceNodeRenderHandler2 renderHandler);
#endif
}

delegate int AVAudioSinkNodeReceiverHandler (AudioTimeStamp timestamp, uint frameCount, ref AudioBuffers inputData);
Expand Down

0 comments on commit 5c06bdd

Please sign in to comment.