mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-09 14:10:05 +00:00
Check the AVAsset's type before casting to an AVURLAsset
This commit is contained in:
parent
a3576d5d61
commit
cb1579e8af
@ -277,7 +277,10 @@
|
|||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_videoLock);
|
ASDN::MutexLocker l(_videoLock);
|
||||||
|
|
||||||
if (ASObjectIsEqual(((AVURLAsset *)asset).URL, ((AVURLAsset *)_asset).URL)) {
|
if (ASObjectIsEqual(asset, _asset)
|
||||||
|
|| ([asset isKindOfClass:[AVURLAsset class]]
|
||||||
|
&& [_asset isKindOfClass:[AVURLAsset class]]
|
||||||
|
&& ASObjectIsEqual(((AVURLAsset *)asset).URL, ((AVURLAsset *)_asset).URL))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
@interface ASVideoNodeTests : XCTestCase
|
@interface ASVideoNodeTests : XCTestCase
|
||||||
{
|
{
|
||||||
ASVideoNode *_videoNode;
|
ASVideoNode *_videoNode;
|
||||||
AVAsset *_firstAsset;
|
AVURLAsset *_firstAsset;
|
||||||
AVAsset *_secondAsset;
|
AVAsset *_secondAsset;
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
@ -43,7 +43,7 @@
|
|||||||
- (void)setUp
|
- (void)setUp
|
||||||
{
|
{
|
||||||
_videoNode = [[ASVideoNode alloc] init];
|
_videoNode = [[ASVideoNode alloc] init];
|
||||||
_firstAsset = [AVAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
_firstAsset = [AVURLAsset assetWithURL:[NSURL URLWithString:@"firstURL"]];
|
||||||
_secondAsset = [AVAsset assetWithURL:[NSURL URLWithString:@"secondURL"]];
|
_secondAsset = [AVAsset assetWithURL:[NSURL URLWithString:@"secondURL"]];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@
|
|||||||
_videoNode.asset = _firstAsset;
|
_videoNode.asset = _firstAsset;
|
||||||
AVPlayerItem *item = [_videoNode currentItem];
|
AVPlayerItem *item = [_videoNode currentItem];
|
||||||
|
|
||||||
_videoNode.asset = _firstAsset;
|
_videoNode.asset = [AVAsset assetWithURL:_firstAsset.URL];
|
||||||
AVPlayerItem *secondItem = [_videoNode currentItem];
|
AVPlayerItem *secondItem = [_videoNode currentItem];
|
||||||
|
|
||||||
XCTAssertEqualObjects(item, secondItem);
|
XCTAssertEqualObjects(item, secondItem);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user