diff --git a/Classes/IncallViewController.m b/Classes/IncallViewController.m index 392f9ab36..d79e41805 100644 --- a/Classes/IncallViewController.m +++ b/Classes/IncallViewController.m @@ -635,20 +635,26 @@ int callCount(LinphoneCore* lc) { // Call Quality Indicator UIImageView* callquality = [UIImageView new]; [callquality setFrame:CGRectMake(0, 0, 28, 28)]; - if (linphone_call_get_average_quality(call) >= 4) { - [callquality setImage: [IncallViewController stat_sys_signal_4]]; - } - else if (linphone_call_get_average_quality(call) >= 3) { - [callquality setImage: [IncallViewController stat_sys_signal_3]]; - } - else if (linphone_call_get_average_quality(call) >= 2) { - [callquality setImage: [IncallViewController stat_sys_signal_2]]; - } - else if (linphone_call_get_average_quality(call) >= 1) { - [callquality setImage: [IncallViewController stat_sys_signal_1]]; + if (call->state == LinphoneCallStreamsRunning) + { + if (linphone_call_get_average_quality(call) >= 4) { + [callquality setImage: [IncallViewController stat_sys_signal_4]]; + } + else if (linphone_call_get_average_quality(call) >= 3) { + [callquality setImage: [IncallViewController stat_sys_signal_3]]; + } + else if (linphone_call_get_average_quality(call) >= 2) { + [callquality setImage: [IncallViewController stat_sys_signal_2]]; + } + else if (linphone_call_get_average_quality(call) >= 1) { + [callquality setImage: [IncallViewController stat_sys_signal_1]]; + } + else { + [callquality setImage: [IncallViewController stat_sys_signal_0]]; + } } else { - [callquality setImage: [IncallViewController stat_sys_signal_0]]; + [callquality setImage:nil]; } if (enc != LinphoneMediaEncryptionNone) { diff --git a/Classes/VideoViewController.h b/Classes/VideoViewController.h index 48a728d42..a8958ff9d 100644 --- a/Classes/VideoViewController.h +++ b/Classes/VideoViewController.h @@ -51,6 +51,7 @@ @property (nonatomic, retain) IBOutlet UIMuteButton* mMute; @property (nonatomic, retain) IBOutlet UIHangUpButton* mHangUp; @property (nonatomic, retain) IBOutlet UICamSwitch* mCamSwitch; +@property (nonatomic, retain) IBOutlet UIImageView *mCallQuality; @property (nonatomic, retain) IBOutlet UIView* mLandscapeRight; @property (nonatomic, retain) IBOutlet UIView* mDisplayLandRight; @@ -65,4 +66,9 @@ @property (nonatomic, retain) IBOutlet UIMuteButton* mMuteLandLeft; @property (nonatomic, retain) IBOutlet UIHangUpButton* mHangUpLandLeft; @property (nonatomic, retain) IBOutlet UICamSwitch* mCamSwitchLandLeft; + +- (void) updateCallQualityIndicator; + +- (void) waitBeforeUpdatingCallQualityIndicator; + @end \ No newline at end of file diff --git a/Classes/VideoViewController.m b/Classes/VideoViewController.m index 56d2476c5..fe4b931a5 100644 --- a/Classes/VideoViewController.m +++ b/Classes/VideoViewController.m @@ -28,6 +28,7 @@ @synthesize mMute; @synthesize mHangUp; @synthesize mCamSwitch; +@synthesize mCallQuality; @synthesize mLandscapeRight; @synthesize mDisplayLandRight; @@ -54,6 +55,7 @@ - (void)dealloc { + [mCallQuality release]; [super dealloc]; } @@ -76,8 +78,38 @@ [mCamSwitch setPreview:mPreview]; [mCamSwitchLandRight setPreview:mPreviewLandRight]; [mCamSwitchLandLeft setPreview:mPreviewLandLeft]; + + [self performSelector:@selector(waitBeforeUpdatingCallQualityIndicator) withObject:nil afterDelay:1]; isFirst=TRUE; } + +- (void) waitBeforeUpdatingCallQualityIndicator +{ + [self performSelectorOnMainThread:@selector(updateCallQualityIndicator) withObject:nil waitUntilDone:YES]; + + [self performSelector:@selector(waitBeforeUpdatingCallQualityIndicator) withObject:nil afterDelay:1]; +} + +- (void) updateCallQualityIndicator +{ + LinphoneCall* call = linphone_core_get_current_call([LinphoneManager getLc]); + + if (linphone_call_get_average_quality(call) >= 4) { + [mCallQuality setImage: [[UIImage imageNamed:@"stat_sys_signal_4.png"] retain]]; + } + else if (linphone_call_get_average_quality(call) >= 3) { + [mCallQuality setImage: [[UIImage imageNamed:@"stat_sys_signal_3.png"] retain]]; + } + else if (linphone_call_get_average_quality(call) >= 2) { + [mCallQuality setImage: [[UIImage imageNamed:@"stat_sys_signal_2.png"] retain]]; + } + else if (linphone_call_get_average_quality(call) >= 1) { + [mCallQuality setImage: [[UIImage imageNamed:@"stat_sys_signal_1.png"] retain]]; + } + else { + [mCallQuality setImage: [[UIImage imageNamed:@"stat_sys_signal_0.png"] retain]]; + } +} -(void) configureOrientation:(UIInterfaceOrientation) oritentation { @@ -113,6 +145,8 @@ - (void)viewDidUnload { + [mCallQuality release]; + mCallQuality = nil; [super viewDidUnload]; // Release any retained subviews of the main view. diff --git a/Classes/VideoViewController.xib b/Classes/VideoViewController.xib index f754d3f1a..0ba0cefe2 100644 --- a/Classes/VideoViewController.xib +++ b/Classes/VideoViewController.xib @@ -36,11 +36,9 @@ IBCocoaTouchFramework - + 292 {320, 460} - - 1 MCAwIDAAA @@ -48,7 +46,7 @@ IBCocoaTouchFramework - + 274 YES @@ -57,8 +55,7 @@ 274 {320, 420} - - + 1 NO IBCocoaTouchFramework @@ -68,7 +65,6 @@ 292 {{1, 418}, {108, 62}} - NO IBCocoaTouchFramework @@ -107,7 +103,6 @@ 292 {{106, 418}, {106, 63}} - NO IBCocoaTouchFramework @@ -132,7 +127,6 @@ 292 {{211, 418}, {108, 62}} - NO IBCocoaTouchFramework 0 @@ -154,7 +148,6 @@ 292 {{233, 309}, {80, 106}} - 3 @@ -165,10 +158,18 @@ IBCocoaTouchFramework + + + 292 + {{6, 387}, {28, 28}} + + + _NS:567 + NO + IBCocoaTouchFramework + {320, 480} - - 3 @@ -177,7 +178,7 @@ IBCocoaTouchFramework - + 292 YES @@ -186,7 +187,6 @@ 274 {420, 320} - 3 @@ -200,7 +200,6 @@ 292 {{420, 0}, {60, 108}} - NO IBCocoaTouchFramework @@ -228,7 +227,6 @@ 292 {{420, 107}, {60, 106}} - NO IBCocoaTouchFramework @@ -250,7 +248,6 @@ 292 {{420, 212}, {60, 108}} - NO IBCocoaTouchFramework 0 @@ -271,7 +268,6 @@ 274 {{308, 233}, {106, 80}} - 3 @@ -282,8 +278,6 @@ {480, 320} - - 3 @@ -297,7 +291,7 @@ IBCocoaTouchFramework - + 292 YES @@ -306,8 +300,7 @@ 274 {{60, 0}, {420, 320}} - - + 3 MQA @@ -320,7 +313,6 @@ 292 {60, 108} - NO IBCocoaTouchFramework @@ -342,8 +334,7 @@ 292 {{0, 107}, {60, 106}} - - + NO IBCocoaTouchFramework 0 @@ -364,7 +355,7 @@ 292 {{0, 212}, {60, 108}} - + NO IBCocoaTouchFramework 0 @@ -385,8 +376,6 @@ 274 {{360, 233}, {106, 80}} - - 3 MQA @@ -396,9 +385,7 @@ {480, 320} - - - + 3 MQA @@ -566,6 +553,14 @@ 51 + + + mCallQuality + + + + 54 + @@ -608,6 +603,7 @@ + portrait @@ -731,6 +727,11 @@ display + + 52 + + + @@ -762,6 +763,7 @@ 38.IBPluginDependency 39.IBPluginDependency 5.IBPluginDependency + 52.IBPluginDependency 6.CustomClassName 6.IBPluginDependency 7.CustomClassName @@ -797,6 +799,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIMuteButton com.apple.InterfaceBuilder.IBCocoaTouchPlugin UIHangUpButton @@ -818,208 +821,9 @@ - 51 - - - - YES - - UICamSwitch - UIButton - - preview - UIView - - - preview - - preview - UIView - - - - IBProjectSource - ./Classes/UICamSwitch.h - - - - UIHangUpButton - UIButton - - IBProjectSource - ./Classes/UIHangUpButton.h - - - - UIMuteButton - UIToggleButton - - IBProjectSource - ./Classes/UIMuteButton.h - - - - UIToggleButton - UIButton - - IBProjectSource - ./Classes/UIToggleButton.h - - - - VideoViewController - UIViewController - - YES - - YES - mCamSwitch - mCamSwitchLandLeft - mCamSwitchLandRight - mDisplay - mDisplayLandLeft - mDisplayLandRight - mHangUp - mHangUpLandLeft - mHangUpLandRight - mLandscapeLeft - mLandscapeRight - mMute - mMuteLandLeft - mMuteLandRight - mPortrait - mPreview - mPreviewLandLeft - mPreviewLandRight - - - YES - UICamSwitch - UICamSwitch - UICamSwitch - UIView - UIView - UIView - UIHangUpButton - UIHangUpButton - UIHangUpButton - UIView - UIView - UIMuteButton - UIMuteButton - UIMuteButton - UIView - UIView - UIView - UIView - - - - YES - - YES - mCamSwitch - mCamSwitchLandLeft - mCamSwitchLandRight - mDisplay - mDisplayLandLeft - mDisplayLandRight - mHangUp - mHangUpLandLeft - mHangUpLandRight - mLandscapeLeft - mLandscapeRight - mMute - mMuteLandLeft - mMuteLandRight - mPortrait - mPreview - mPreviewLandLeft - mPreviewLandRight - - - YES - - mCamSwitch - UICamSwitch - - - mCamSwitchLandLeft - UICamSwitch - - - mCamSwitchLandRight - UICamSwitch - - - mDisplay - UIView - - - mDisplayLandLeft - UIView - - - mDisplayLandRight - UIView - - - mHangUp - UIHangUpButton - - - mHangUpLandLeft - UIHangUpButton - - - mHangUpLandRight - UIHangUpButton - - - mLandscapeLeft - UIView - - - mLandscapeRight - UIView - - - mMute - UIMuteButton - - - mMuteLandLeft - UIMuteButton - - - mMuteLandRight - UIMuteButton - - - mPortrait - UIView - - - mPreview - UIView - - - mPreviewLandLeft - UIView - - - mPreviewLandRight - UIView - - - - - IBProjectSource - ./Classes/VideoViewController.h - - - + 54 + 0 IBCocoaTouchFramework