IxoPlayer: Refactor DASH manifest parsing tests. Exhaustively check the entire manifest instead of cherry-picking fields. - Read all prop field names. - Walk all props and compare values using match helpers based on field type. Change-Id: I19edb4580d43cc5fb0101a53b3e8741b6cccce13
diff --git a/vpx_ios/IxoPlayer/IxoDASHManifestParser.m b/vpx_ios/IxoPlayer/IxoDASHManifestParser.m index be63c28..2097651 100644 --- a/vpx_ios/IxoPlayer/IxoDASHManifestParser.m +++ b/vpx_ios/IxoPlayer/IxoDASHManifestParser.m
@@ -14,7 +14,7 @@ // // IxoDASHRepresentation // -@interface IxoDASHRepresentation() +@interface IxoDASHRepresentation () @property(nonatomic, strong) NSString* repID; @property(nonatomic) int bandwidth; @property(nonatomic) int width; @@ -63,7 +63,7 @@ // // IxoDASHAdaptationSet // -@interface IxoDASHAdaptationSet() +@interface IxoDASHAdaptationSet () @property(nonatomic, strong) NSString* setID; @property(nonatomic, strong) NSString* mimeType; @property(nonatomic, strong) NSString* codecs; @@ -109,7 +109,7 @@ // // IxoDASHPeriod // -@interface IxoDASHPeriod() +@interface IxoDASHPeriod () @property(nonatomic, strong) NSString* periodID; @property(nonatomic, strong) NSString* start; @property(nonatomic, strong) NSString* duration; @@ -140,7 +140,7 @@ // // IxoDASHManifest // -@interface IxoDASHManifest() +@interface IxoDASHManifest () @property(nonatomic, strong) NSString* mediaPresentationDuration; @property(nonatomic, strong) NSString* minBufferTime; @property(nonatomic) bool staticPresentation; @@ -272,6 +272,15 @@ return true; } +- (NSMutableArray*)convertStringArrayToNumberArray:(NSArray*)array { + NSMutableArray* numbers_array = [[NSMutableArray alloc] init]; + NSNumberFormatter* formatter = [[NSNumberFormatter alloc] init]; + for (NSString* str in array) { + [numbers_array addObject:[formatter numberFromString:str]]; + } + return numbers_array; +} + // // Attribute parsing helpers. // @@ -404,8 +413,10 @@ return false; } IxoDASHRepresentation* rep = [_lastAdaptationSet.representations lastObject]; + NSArray* range_strings = [index_range_str componentsSeparatedByString:@"-"]; rep.segmentBaseIndexRange = - [index_range_str componentsSeparatedByString:@"-"]; + [self convertStringArrayToNumberArray:range_strings]; + if (rep.segmentBaseIndexRange.count != 2) { NSLog(@"parseSegmentBaseAttributes: Invalid indexRange."); return false; @@ -426,7 +437,9 @@ return false; } IxoDASHRepresentation* rep = [_lastAdaptationSet.representations lastObject]; - rep.initializationRange = [range_str componentsSeparatedByString:@"-"]; + NSArray* range_strings = [range_str componentsSeparatedByString:@"-"]; + rep.initializationRange = + [self convertStringArrayToNumberArray:range_strings]; if (rep.initializationRange.count != 2) { NSLog(@"parseInitializationAttributes: Invalid range."); return false;
diff --git a/vpx_ios/IxoPlayer/IxoDASHManifestParserConstants.h b/vpx_ios/IxoPlayer/IxoDASHManifestParserConstants.h index cfe377c..1f6c75f 100644 --- a/vpx_ios/IxoPlayer/IxoDASHManifestParserConstants.h +++ b/vpx_ios/IxoPlayer/IxoDASHManifestParserConstants.h
@@ -43,7 +43,7 @@ FOUNDATION_EXPORT NSString* const kMimeTypeWebmVideo; FOUNDATION_EXPORT NSString* const kCodecOpus; -FOUNDATION_EXPORT NSString* const kCodecVorbus; +FOUNDATION_EXPORT NSString* const kCodecVorbis; FOUNDATION_EXPORT NSString* const kCodecVP8; FOUNDATION_EXPORT NSString* const kCodecVP9;
diff --git a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestParserTests.m b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestParserTests.m index 304923d..f5de6c9 100644 --- a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestParserTests.m +++ b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestParserTests.m
@@ -8,18 +8,20 @@ #import "IxoDASHManifestParser.h" #import <Foundation/Foundation.h> +#import <objc/runtime.h> #import <XCTest/XCTest.h> +#import "IxoDASHManifestTestData.h" #import "IxoPlayerTestCommon.h" @interface IxoDASHManifestParserTests : XCTestCase @end -@implementation IxoDASHManifestParserTests { -} +@implementation IxoDASHManifestParserTests -// Note: -setUp and -tearDown are called for each test. - +// +// XCTest methods. +// - (void)setUp { [super setUp]; } @@ -28,93 +30,178 @@ [super tearDown]; } -- (void)testParseDASHMPD1 { +// +// IxoDASHManifestParser parser test helpers. +// + +- (bool)idIsArrayType:(id)unknownType { + return [unknownType isKindOfClass:[NSArray class]]; +} + +- (bool)idIsStringType:(id)unknownType { + return [unknownType isKindOfClass:[NSString class]]; +} + +- (bool)arrayMatches:(NSArray*)arr array:(NSArray*)otherArray { + return [arr isEqualToArray:otherArray] == YES; +} + +- (bool)stringMatches:(NSString*)str string:(NSString*)otherStr { + return [str isEqualToString:otherStr] == YES; +} + +// Returns array of property names for given type id. +- (NSArray*)allPropertyNamesForType:(id)type { + uint num_props; + objc_property_t* const properties = + class_copyPropertyList([type class], &num_props); + NSMutableArray* prop_names = [NSMutableArray array]; + + for (uint i = 0; i < num_props; ++i) { + objc_property_t property = properties[i]; + NSString* const name = + [NSString stringWithUTF8String:property_getName(property)]; + [prop_names addObject:name]; + } + free(properties); + NSLog(@"allPropertyNamesForType: returning %@", prop_names); + return prop_names; +} + +// Returns true when representations match, or dies. +- (bool)representationMatches:(IxoDASHRepresentation*)rep + ExpectedRepresentation:(IxoMutableDASHRepresentation*)expectedRep { + NSArray* const props = + [self allPropertyNamesForType:[IxoDASHRepresentation class]]; + for (NSString* const prop in props) { + // Compare the prop values. + if ([self idIsArrayType:[rep valueForKey:prop]]) { + XCTAssertTrue([self arrayMatches:[rep valueForKey:prop] + array:[expectedRep valueForKey:prop]]); + } else if ([self idIsStringType:[rep valueForKey:prop]]) { + XCTAssertTrue([self stringMatches:[rep valueForKey:prop] + string:[expectedRep valueForKey:prop]]); + + } else { + XCTAssertEqual([rep valueForKey:prop], [expectedRep valueForKey:prop]); + } + } + return true; +} + +// Returns true when AdaptationSets match, or dies. +- (bool)adaptationSetMatches:(IxoDASHAdaptationSet*)set + ExpectedAdaptationSet:(IxoMutableDASHAdaptationSet*)expectedSet { + NSArray* const props = + [self allPropertyNamesForType:[IxoDASHAdaptationSet class]]; + + // Compare AdaptationSet attributes. + for (NSString* const prop in props) { + // Representation(s) check is done below; skip it here. + if ([prop isEqualToString:@"representations"]) { + continue; + } + + // Compare the prop values. + if ([self idIsStringType:[set valueForKey:prop]]) { + XCTAssertTrue([self stringMatches:[set valueForKey:prop] + string:[expectedSet valueForKey:prop]]); + } else { + XCTAssertEqual([set valueForKey:prop], [expectedSet valueForKey:prop]); + } + } + + // Compare the Representation elements from the AdaptationSet. + XCTAssertEqual(set.representations.count, expectedSet.representations.count); + for (uint i = 0; i < set.representations.count; ++i) { + XCTAssertTrue([self + representationMatches:[set.representations objectAtIndex:i] + ExpectedRepresentation:[expectedSet.representations objectAtIndex:i]]); + } + return true; +} + +// Returns true when Periods match, or dies. +- (bool)periodMatches:(IxoDASHPeriod*)period + ExpectedPeriod:(IxoMutableDASHPeriod*)expectedPeriod { + NSArray* const props = [self allPropertyNamesForType:[IxoDASHPeriod class]]; + + // Compare Period attributes. + for (NSString* const prop in props) { + // {audio|video}AdaptationSets are checked below; skip the checks here. + if ([prop isEqualToString:@"audioAdaptationSets"] || + [prop isEqualToString:@"videoAdaptationSets"]) { + continue; + } + + XCTAssertTrue([[period valueForKey:prop] + isEqualToString:[expectedPeriod valueForKey:prop]]); + } + + // Compare the audio AdaptationSet elements from the Period. + XCTAssertEqual(period.audioAdaptationSets.count, + expectedPeriod.audioAdaptationSets.count); + for (uint i = 0; i < period.audioAdaptationSets.count; ++i) { + XCTAssertTrue( + [self adaptationSetMatches:[period.audioAdaptationSets objectAtIndex:i] + ExpectedAdaptationSet:[expectedPeriod.audioAdaptationSets + objectAtIndex:i]]); + } + + // Compare the audio AdaptationSet elements from the Period. + XCTAssertEqual(period.videoAdaptationSets.count, + expectedPeriod.videoAdaptationSets.count); + for (uint i = 0; i < period.videoAdaptationSets.count; ++i) { + XCTAssertTrue( + [self adaptationSetMatches:[period.videoAdaptationSets objectAtIndex:i] + ExpectedAdaptationSet:[expectedPeriod.videoAdaptationSets + objectAtIndex:i]]); + } + + return true; +} + +// Returns true when manifests match, or dies. +- (bool)manifestMatches:(IxoDASHManifest*)manifest + ExpectedManifest:(IxoMutableDASHManifest*)expectedManifest { + NSArray* const props = [self allPropertyNamesForType:[IxoDASHManifest class]]; + + // Compare manifest attributes. + for (NSString* const prop in props) { + // Period check is done below; skip it here. + if ([prop isEqualToString:@"period"]) { + continue; + } + + if ([self idIsStringType:[manifest valueForKey:prop]]) { + XCTAssertTrue([self stringMatches:[manifest valueForKey:prop] + string:[expectedManifest valueForKey:prop]]); + } else { + XCTAssertEqual([manifest valueForKey:prop], + [expectedManifest valueForKey:prop]); + } + } + + // Compare the Representation elements from the AdaptationSet. + XCTAssertTrue([self periodMatches:manifest.period + ExpectedPeriod:expectedManifest.period]); + return true; +} + +// +// IxoDASHManifestParser tests. +// +- (void)testParseDASH1 { NSURL* const manifest_url = [NSURL URLWithString:kVP9VorbisDASHMPD1URLString]; IxoDASHManifestParser* parser = [[IxoDASHManifestParser alloc] initWithManifestURL:manifest_url]; const bool parse_ok = [parser parse]; XCTAssertTrue(parse_ok); - // Verify MPD attributes. IxoDASHManifest* const manifest = parser.manifest; - XCTAssertEqual(manifest.staticPresentation, kVP9VorbisDASHMPD1IsStatic); - XCTAssertTrue([manifest.mediaPresentationDuration - isEqualToString:kVP9VorbisDASHMPD1MediaPresentationDuration]); + IxoMutableDASHManifest* const expected_manifest = [IxoDASHManifestTestData + getExpectedManifestForURLString:kVP9VorbisDASHMPD1URLString]; XCTAssertTrue( - [manifest.minBufferTime isEqualToString:kVP9VorbisDASHMPD1MinBufferTime]); - - // Verify Period attributes. - IxoDASHPeriod* const period = manifest.period; - XCTAssertTrue([period.periodID isEqualToString:kVP9VorbisDASHMPD1PeriodID]); - XCTAssertTrue([period.start isEqualToString:kVP9VorbisDASHMPD1PeriodStart]); - XCTAssertTrue( - [period.duration isEqualToString:kVP9VorbisDASHMPD1PeriodDuration]); - - // Verify audio AdaptationSet attributes. - XCTAssertEqual([period.audioAdaptationSets count], - kVP9VorbisDASHMPD1AudioASCount); - IxoDASHAdaptationSet* const audio_as = - [period.audioAdaptationSets lastObject]; - XCTAssertTrue([audio_as.setID isEqualToString:kVP9VorbisDASHMPD1AudioASID]); - XCTAssertTrue( - [audio_as.codecs isEqualToString:kVP9VorbisDASHMPD1AudioASCodecs]); - XCTAssertTrue( - [audio_as.mimeType isEqualToString:kVP9VorbisDASHMPD1AudioASMimeType]); - XCTAssertEqual(audio_as.audioSamplingRate, - kVP9VorbisDASHMPD1AudioASAudioSamplingRate); - - // Verify first audio representation attributes. - XCTAssertEqual([audio_as.representations count], - kVP9VorbisDASHMPD1AudioRepCount); - IxoDASHRepresentation* const audio_rep = - [audio_as.representations firstObject]; - XCTAssertTrue( - [audio_rep.repID isEqualToString:kVP9VorbisDASHMPD1AudioRep0ID]); - XCTAssertTrue([audio_rep.baseURL - isEqualToString:kVP9VorbisDASHMPD1AudioRep0BaseURLString]); - XCTAssertEqual([audio_rep.segmentBaseIndexRange count], - kNumElementsInRangeArray); - XCTAssertEqual([[audio_rep.segmentBaseIndexRange firstObject] intValue], - kVP9VorbisDASHMPD1AudioRep0IndexRangeStart); - XCTAssertEqual([[audio_rep.segmentBaseIndexRange lastObject] intValue], - kVP9VorbisDASHMPD1AudioRep0IndexRangeEnd); - XCTAssertEqual([[audio_rep.initializationRange firstObject] intValue], - kVP9VorbisDASHMPD1AudioRep0InitRangeStart); - XCTAssertEqual([[audio_rep.initializationRange lastObject] intValue], - kVP9VorbisDASHMPD1AudioRep0InitRangeEnd); - XCTAssertEqual(audio_rep.bandwidth, kVP9VorbisDASHMPD1AudioRep0Bandwidth); - - // Verify video AdaptationSet attributes. - XCTAssertEqual([period.videoAdaptationSets count], - kVP9VorbisDASHMPD1VideoASCount); - IxoDASHAdaptationSet* const video_as = - [period.videoAdaptationSets lastObject]; - XCTAssertTrue([video_as.setID isEqualToString:kVP9VorbisDASHMPD1VideoASID]); - XCTAssertTrue( - [video_as.codecs isEqualToString:kVP9VorbisDASHMPD1VideoASCodecs]); - XCTAssertTrue( - [video_as.mimeType isEqualToString:kVP9VorbisDASHMPD1VideoASMimeType]); - - // Verify first audio representation attributes. - XCTAssertEqual([video_as.representations count], - kVP9VorbisDASHMPD1VideoRepCount); - IxoDASHRepresentation* const video_rep = - [video_as.representations firstObject]; - XCTAssertTrue( - [video_rep.repID isEqualToString:kVP9VorbisDASHMPD1VideoRep0ID]); - XCTAssertTrue([video_rep.baseURL - isEqualToString:kVP9VorbisDASHMPD1VideoRep0BaseURLString]); - XCTAssertEqual([video_rep.segmentBaseIndexRange count], - kNumElementsInRangeArray); - XCTAssertEqual([[video_rep.segmentBaseIndexRange firstObject] intValue], - kVP9VorbisDASHMPD1VideoRep0IndexRangeStart); - XCTAssertEqual([[video_rep.segmentBaseIndexRange lastObject] intValue], - kVP9VorbisDASHMPD1VideoRep0IndexRangeEnd); - XCTAssertEqual([[video_rep.initializationRange firstObject] intValue], - kVP9VorbisDASHMPD1VideoRep0InitRangeStart); - XCTAssertEqual([[video_rep.initializationRange lastObject] intValue], - kVP9VorbisDASHMPD1VideoRep0InitRangeEnd); - XCTAssertEqual(video_rep.bandwidth, kVP9VorbisDASHMPD1VideoRep0Bandwidth); + [self manifestMatches:manifest ExpectedManifest:expected_manifest]); } - @end
diff --git a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestTestData.m b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestTestData.m index 3069403..7229c55 100644 --- a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestTestData.m +++ b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoDASHManifestTestData.m
@@ -26,18 +26,11 @@ audio_as.codecs = kCodecVorbis; audio_as.mimeType = kMimeTypeWebmAudio; audio_as.audioSamplingRate = 44100; + audio_as.subsegmentAlignment = true; + audio_as.subsegmentStartsWithSAP = 1; - // rep id 5 from adaptation set id 1 in period id 0. IxoMutableDASHRepresentation* audio_rep = [[IxoMutableDASHRepresentation alloc] init]; - audio_rep.repID = @"5"; - audio_rep.bandwidth = 161358; - audio_rep.baseURL = @"glass_172.webm"; - audio_rep.segmentBaseIndexRange = @[ @2698316, @2698871 ]; - audio_rep.initializationRange = @[ @0, @4243 ]; - - NSMutableArray* const audio_reps = - [[NSMutableArray alloc] initWithObjects:[audio_rep copy], nil]; // rep id 4 from adaptation set id 1 in period id 0. audio_rep.repID = @"4"; @@ -45,8 +38,15 @@ audio_rep.baseURL = @"glass_171.webm"; audio_rep.segmentBaseIndexRange = @[ @1839501, @1840056 ]; audio_rep.initializationRange = @[ @0, @4700 ]; - [audio_reps addObject:audio_rep]; - audio_as.representations = audio_reps; + [audio_as.representations addObject:[audio_rep copy]]; + + // rep id 5 from adaptation set id 1 in period id 0. + audio_rep.repID = @"5"; + audio_rep.bandwidth = 161358; + audio_rep.baseURL = @"glass_172.webm"; + audio_rep.segmentBaseIndexRange = @[ @2698316, @2698871 ]; + audio_rep.initializationRange = @[ @0, @4243 ]; + [audio_as.representations addObject:audio_rep]; // adaptation set id 0 from period id 0 in period id 0. IxoMutableDASHAdaptationSet* video_as = @@ -54,40 +54,12 @@ video_as.setID = @"0"; video_as.codecs = kCodecVP9; video_as.mimeType = kMimeTypeWebmVideo; + video_as.subsegmentAlignment = true; + video_as.bitstreamSwitching = true; + video_as.subsegmentStartsWithSAP = 1; - // rep id 3 from adaptation set id 0 in period id 0. IxoMutableDASHRepresentation* video_rep = [[IxoMutableDASHRepresentation alloc] init]; - video_rep.repID = @"3"; - video_rep.bandwidth = 433418; - video_rep.width = 1280; - video_rep.height = 720; - video_rep.baseURL = @"glass_247.webm"; - video_rep.segmentBaseIndexRange = @[ @4937831, @4938386 ]; - video_rep.initializationRange = @[ @0, @441 ]; - [video_as.representations addObject:[video_rep copy]]; - - NSMutableArray* const video_reps = - [[NSMutableArray alloc] initWithObjects:[video_rep copy], nil]; - - // rep id 2 from adaptation set id 0 in period id 0. - video_rep.repID = @"2"; - video_rep.bandwidth = 279133; - video_rep.width = 854; - video_rep.height = 480; - video_rep.baseURL = @"glass_244.webm"; - video_rep.segmentBaseIndexRange = @[ @3723746, @3724301 ]; - video_rep.initializationRange = @[ @0, @441 ]; - [video_reps addObject:[video_rep copy]]; - - // rep id 1 from adaptation set id 0 in period id 0. - video_rep.bandwidth = 229655; - video_rep.width = 640; - video_rep.height = 360; - video_rep.baseURL = @"glass_243.webm"; - video_rep.segmentBaseIndexRange = @[ @3328041, @3328596 ]; - video_rep.initializationRange = @[ @0, @441 ]; - [video_reps addObject:[video_rep copy]]; // rep id 0 from adaptation set id 0 in period id 0. video_rep.repID = @"0"; @@ -97,8 +69,37 @@ video_rep.baseURL = @"glass_242.webm"; video_rep.segmentBaseIndexRange = @[ @2983244, @2983799 ]; video_rep.initializationRange = @[ @0, @439 ]; - [video_reps addObject:[video_rep copy]]; - video_as.representations = video_reps; + [video_as.representations addObject:[video_rep copy]]; + + // rep id 1 from adaptation set id 0 in period id 0. + video_rep.repID = @"1"; + video_rep.bandwidth = 229655; + video_rep.width = 640; + video_rep.height = 360; + video_rep.baseURL = @"glass_243.webm"; + video_rep.segmentBaseIndexRange = @[ @3328041, @3328596 ]; + video_rep.initializationRange = @[ @0, @441 ]; + [video_as.representations addObject:[video_rep copy]]; + + // rep id 2 from adaptation set id 0 in period id 0. + video_rep.repID = @"2"; + video_rep.bandwidth = 279133; + video_rep.width = 854; + video_rep.height = 480; + video_rep.baseURL = @"glass_244.webm"; + video_rep.segmentBaseIndexRange = @[ @3723746, @3724301 ]; + video_rep.initializationRange = @[ @0, @441 ]; + [video_as.representations addObject:[video_rep copy]]; + + // rep id 3 from adaptation set id 0 in period id 0. + video_rep.repID = @"3"; + video_rep.bandwidth = 433418; + video_rep.width = 1280; + video_rep.height = 720; + video_rep.baseURL = @"glass_247.webm"; + video_rep.segmentBaseIndexRange = @[ @4937831, @4938386 ]; + video_rep.initializationRange = @[ @0, @441 ]; + [video_as.representations addObject:video_rep]; // period id 0. IxoMutableDASHPeriod* period = [[IxoMutableDASHPeriod alloc] init];
diff --git a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.h b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.h index 8f52216..b0f6052 100644 --- a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.h +++ b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.h
@@ -11,7 +11,7 @@ // Mutable versions of the IxoDASHManifestParser data classes for testing. // -@interface IxoMutableDASHRepresentation : IxoDASHRepresentation<NSCopying> +@interface IxoMutableDASHRepresentation : NSObject<NSCopying> @property(nonatomic, strong) NSString* repID; @property(nonatomic) int bandwidth; @property(nonatomic) int width; @@ -27,7 +27,7 @@ - (id)init; @end -@interface IxoMutableDASHAdaptationSet : IxoDASHAdaptationSet +@interface IxoMutableDASHAdaptationSet : NSObject @property(nonatomic, strong) NSString* setID; @property(nonatomic, strong) NSString* mimeType; @property(nonatomic, strong) NSString* codecs; @@ -42,7 +42,7 @@ - (id)init; @end -@interface IxoMutableDASHPeriod : IxoDASHPeriod +@interface IxoMutableDASHPeriod : NSObject @property(nonatomic, strong) NSString* periodID; @property(nonatomic, strong) NSString* start; @property(nonatomic, strong) NSString* duration; @@ -52,7 +52,7 @@ - (id)init; @end -@interface IxoMutableDASHManifest : IxoDASHManifest +@interface IxoMutableDASHManifest : NSObject @property(nonatomic, strong) NSString* mediaPresentationDuration; @property(nonatomic, strong) NSString* minBufferTime; @property(nonatomic) bool staticPresentation;
diff --git a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.m b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.m index f31788f..0a9653d 100644 --- a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.m +++ b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoMutableDASHManifest.m
@@ -41,7 +41,7 @@ return self; } -- (id)copyWithZone:(NSZone *)zone { +- (id)copyWithZone:(NSZone*)zone { IxoMutableDASHRepresentation* copy = [[IxoMutableDASHRepresentation alloc] init]; if (copy) { @@ -79,8 +79,7 @@ - (id)init { self = [super init]; if (self) { - _setID = nil; - // self.setID = nil; + self.setID = nil; self.mimeType = nil; self.codecs = nil; self.subsegmentAlignment = false; @@ -89,7 +88,7 @@ self.width = 0; self.height = 0; self.audioSamplingRate = 0; - self.representations = nil; + self.representations = [[NSMutableArray alloc] init]; } return self; } @@ -111,8 +110,8 @@ self.periodID = nil; self.start = nil; self.duration = nil; - self.audioAdaptationSets = nil; - self.videoAdaptationSets = nil; + self.audioAdaptationSets = [[NSMutableArray alloc] init]; + self.videoAdaptationSets = [[NSMutableArray alloc] init]; } return self; }
diff --git a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.h b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.h index 12015d5..a5deebd 100644 --- a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.h +++ b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.h
@@ -29,47 +29,8 @@ FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1LastLineOffset; FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1LastLine; -// DASH manifest parsing result constants. -FOUNDATION_EXPORT const bool kVP9VorbisDASHMPD1IsStatic; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1MediaPresentationDuration; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1MinBufferTime; - -// Period constants. -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1PeriodID; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1PeriodStart; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1PeriodDuration; - -// Audio AdaptationSet constants. -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioASCount; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1AudioASID; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1AudioASCodecs; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1AudioASMimeType; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioASAudioSamplingRate; - -// Video AdaptationSet constants. -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoASCount; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1VideoASID; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1VideoASCodecs; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1VideoASMimeType; - -// Audio Representation count and Representation 0 constants. -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioRepCount; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1AudioRep0ID; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1AudioRep0BaseURLString; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioRep0IndexRangeStart; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioRep0IndexRangeEnd; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioRep0InitRangeStart; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioRep0InitRangeEnd; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1AudioRep0Bandwidth; - -// Video Representation count and Representation 0 constants. -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRepCount; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1VideoRep0ID; -FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD1VideoRep0BaseURLString; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0IndexRangeStart; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0IndexRangeEnd; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0InitRangeStart; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0InitRangeEnd; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0Width; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0Height; -FOUNDATION_EXPORT const int kVP9VorbisDASHMPD1VideoRep0Bandwidth; +// +// URLs for additional test manifest files. +// +FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD2URLString; +FOUNDATION_EXPORT NSString* const kVP9VorbisDASHMPD3URLString; \ No newline at end of file
diff --git a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.m b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.m index c4c68fe..ac97185 100644 --- a/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.m +++ b/vpx_ios/IxoPlayer/IxoPlayerTests/IxoPlayerTestCommon.m
@@ -7,6 +7,9 @@ // be found in the AUTHORS file in the root of the source tree. #import "IxoPlayerTestCommon.h" +#import "IxoDASHManifestParserConstants.h" +#import "IxoDASHManifestTestData.h" + const int kNumElementsInRangeArray = 2; // @@ -31,49 +34,4 @@ const int kVP9VorbisDASHMPD1LastLineLength = 6; const int kVP9VorbisDASHMPD1LastLineOffset = 1998; -NSString* const kVP9VorbisDASHMPD1LastLine = @"</MPD>"; - -// DASH manifest parsing result constants. -const bool kVP9VorbisDASHMPD1IsStatic = true; -NSString* const kVP9VorbisDASHMPD1MediaPresentationDuration = @"PT135.629S"; -NSString* const kVP9VorbisDASHMPD1MinBufferTime = @"PT1S"; - -// Period constants. -NSString* const kVP9VorbisDASHMPD1PeriodID = @"0"; -NSString* const kVP9VorbisDASHMPD1PeriodStart = @"PT0S"; -NSString* const kVP9VorbisDASHMPD1PeriodDuration = @"PT135.629S"; - -// Audio AdaptationSet constants. -const int kVP9VorbisDASHMPD1AudioASCount = 1; -NSString* const kVP9VorbisDASHMPD1AudioASID = @"1"; -NSString* const kVP9VorbisDASHMPD1AudioASCodecs = @"vorbis"; -NSString* const kVP9VorbisDASHMPD1AudioASMimeType = @"audio/webm"; -const int kVP9VorbisDASHMPD1AudioASAudioSamplingRate = 44100; - -// Video AdaptationSet constants. -const int kVP9VorbisDASHMPD1VideoASCount = 1; -NSString* const kVP9VorbisDASHMPD1VideoASID = @"0"; -NSString* const kVP9VorbisDASHMPD1VideoASCodecs = @"vp9"; -NSString* const kVP9VorbisDASHMPD1VideoASMimeType = @"video/webm"; - -// Audio Representation count and Representation 0 constants. -const int kVP9VorbisDASHMPD1AudioRepCount = 2; -NSString* const kVP9VorbisDASHMPD1AudioRep0ID = @"4"; -NSString* const kVP9VorbisDASHMPD1AudioRep0BaseURLString = @"glass_171.webm"; -const int kVP9VorbisDASHMPD1AudioRep0IndexRangeStart = 1839501; -const int kVP9VorbisDASHMPD1AudioRep0IndexRangeEnd = 1840056; -const int kVP9VorbisDASHMPD1AudioRep0InitRangeStart = 0; -const int kVP9VorbisDASHMPD1AudioRep0InitRangeEnd = 4700; -const int kVP9VorbisDASHMPD1AudioRep0Bandwidth = 109755; - -// Video Representation count and Representation 0 constants. -const int kVP9VorbisDASHMPD1VideoRepCount = 4; -NSString* const kVP9VorbisDASHMPD1VideoRep0ID = @"0"; -NSString* const kVP9VorbisDASHMPD1VideoRep0BaseURLString = @"glass_242.webm"; -const int kVP9VorbisDASHMPD1VideoRep0IndexRangeStart = 2983244; -const int kVP9VorbisDASHMPD1VideoRep0IndexRangeEnd = 2983799; -const int kVP9VorbisDASHMPD1VideoRep0InitRangeStart = 0; -const int kVP9VorbisDASHMPD1VideoRep0InitRangeEnd = 439; -const int kVP9VorbisDASHMPD1VideoRep0Width = 426; -const int kVP9VorbisDASHMPD1VideoRep0Height = 240; -const int kVP9VorbisDASHMPD1VideoRep0Bandwidth = 204463; \ No newline at end of file +NSString* const kVP9VorbisDASHMPD1LastLine = @"</MPD>"; \ No newline at end of file