Commit 7551b1e6 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[CRD iOS] Disable video channel when app goes to background

Make HostViewController call EnableVideoChannel(false) when the app is
inactive. This can save some battery for the device.

Bug: 824554
Change-Id: Ic468344509bcb9458a592cf4eea8e5b28a939f90
Reviewed-on: https://chromium-review.googlesource.com/974506Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544957}
parent e5d9939e
......@@ -130,7 +130,7 @@ class ChromotingSession : public ClientInputInjector {
void SendClientResolution(int dips_width, int dips_height, int scale);
// Enables or disables the video channel. May be called from any thread.
// Enables or disables the video channel.
void EnableVideoChannel(bool enable);
void SendClientMessage(const std::string& type, const std::string& data);
......
......@@ -640,6 +640,7 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext";
LOG(DFATAL) << "Blur view does not exist.";
return;
}
[_client setVideoChannelEnabled:YES];
[_blurView removeFromSuperview];
_blurView = nil;
}
......@@ -660,6 +661,7 @@ static NSString* const kFeedbackContext = @"InSessionFeedbackContext";
[_blurView.topAnchor constraintEqualToAnchor:_hostView.topAnchor],
[_blurView.bottomAnchor constraintEqualToAnchor:_hostView.bottomAnchor],
]];
[_client setVideoChannelEnabled:NO];
}
@end
......@@ -75,6 +75,8 @@ extern NSString* const kHostSessionPin;
- (void)setHostResolution:(CGSize)dipsResolution scale:(int)scale;
- (void)setVideoChannelEnabled:(BOOL)enabled;
// Creates a feedback data and returns it to the callback.
- (void)createFeedbackDataWithCallback:
(void (^)(const remoting::FeedbackData&))callback;
......
......@@ -359,6 +359,10 @@ static void ResolveFeedbackDataCallback(
scale);
}
- (void)setVideoChannelEnabled:(BOOL)enabled {
_session->EnableVideoChannel(enabled);
}
- (void)createFeedbackDataWithCallback:
(void (^)(const remoting::FeedbackData&))callback {
if (!_session) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment