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