mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Temp
This commit is contained in:
parent
c767cc94e0
commit
01ada86293
@ -435,7 +435,7 @@ public final class SoftwareAudioSource {
|
||||
|
||||
let (decodableFrame, _) = self.readDecodableFrame()
|
||||
if let decodableFrame = decodableFrame {
|
||||
return (decodableFrame.copyPacketData(), Int(decodableFrame.packet.duration - max(0, -decodableFrame.packet.pts)))
|
||||
return (decodableFrame.copyPacketData(), Int(decodableFrame.packet.duration))
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
|
@ -64,12 +64,24 @@ private final class DemoBroadcastPacketSource {
|
||||
|
||||
let fileName = String(format: "%04d", index)
|
||||
if let path = getAppBundle().path(forResource: fileName, ofType: "ogg") {
|
||||
let source = SoftwareAudioSource(path: path)
|
||||
let source1 = SoftwareAudioSource(path: path)
|
||||
let source2 = SoftwareAudioSource(path: path)
|
||||
let frames = OggOpusReader.extractFrames(try! Data(contentsOf: URL(fileURLWithPath: path)))!
|
||||
while true {
|
||||
if let frame = source.readFrame() {
|
||||
packets.append(OngoingGroupCallBroadcastPacket(numSamples: Int32(frame.count / 2), data: frame))
|
||||
if true {
|
||||
if let (frame, numSamples) = source1.readEncodedFrame() {
|
||||
let decodedFrame = source2.readFrame()!
|
||||
|
||||
packets.append(OngoingGroupCallBroadcastPacket(numSamples: Int32(numSamples), data: frames[packets.count].data, decodedData: decodedFrame))
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
break
|
||||
if let frame = source2.readFrame() {
|
||||
packets.append(OngoingGroupCallBroadcastPacket(numSamples: Int32(frame.count / 2), data: frame, decodedData: frame))
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,8 +169,9 @@ typedef NS_ENUM(int32_t, GroupCallNetworkState) {
|
||||
|
||||
@property (nonatomic, readonly) int numSamples;
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull data;
|
||||
@property (nonatomic, strong, readonly) NSData * _Nonnull decodedData;
|
||||
|
||||
- (instancetype _Nonnull)initWithNumSamples:(int)numSamples data:(NSData * _Nonnull)data;
|
||||
- (instancetype _Nonnull)initWithNumSamples:(int)numSamples data:(NSData * _Nonnull)data decodedData:(NSData * _Nonnull)decodedData;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -1407,8 +1407,13 @@ static void processJoinPayload(tgcalls::GroupJoinPayload &payload, void (^ _Nonn
|
||||
for (OngoingGroupCallBroadcastPacket *packet in packets) {
|
||||
tgcalls::BroadcastPacket parsedPacket;
|
||||
parsedPacket.numSamples = packet.numSamples;
|
||||
|
||||
parsedPacket.data.resize(packet.data.length);
|
||||
[packet.data getBytes:parsedPacket.data.data() length:packet.data.length];
|
||||
|
||||
parsedPacket.decodedData.resize(packet.decodedData.length);
|
||||
[packet.decodedData getBytes:parsedPacket.decodedData.data() length:packet.decodedData.length];
|
||||
|
||||
parsedPackets.push_back(std::move(parsedPacket));
|
||||
}
|
||||
((tgcalls::GroupInstanceCustomImpl *)(_instance.get()))->addBroadcastPackets(std::move(parsedPackets));
|
||||
@ -1431,11 +1436,12 @@ static void processJoinPayload(tgcalls::GroupJoinPayload &payload, void (^ _Nonn
|
||||
|
||||
@implementation OngoingGroupCallBroadcastPacket
|
||||
|
||||
- (instancetype _Nonnull)initWithNumSamples:(int)numSamples data:(NSData * _Nonnull)data {
|
||||
- (instancetype _Nonnull)initWithNumSamples:(int)numSamples data:(NSData * _Nonnull)data decodedData:(NSData * _Nonnull)decodedData {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_numSamples = numSamples;
|
||||
_data = data;
|
||||
_decodedData = decodedData;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user