blob: 80cca265f3c5467ffdfaa488955555a1b1b1fd56 [file] [log] [blame]
Vladimir Olteand0aa6472019-01-09 01:13:10 +02001/*
2 * Copyright 2012, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "RemoteDisplay.h"
18
19#include "source/WifiDisplaySource.h"
20
21#include <media/IRemoteDisplayClient.h>
22#include <media/stagefright/foundation/ADebug.h>
23#include <media/stagefright/foundation/AMessage.h>
Nico4422b262019-11-01 15:41:51 +000024#include <media/stagefright/ANetworkSession.h>
Vladimir Olteand0aa6472019-01-09 01:13:10 +020025
26namespace android {
27
28RemoteDisplay::RemoteDisplay(
29 const String16 &opPackageName,
30 const sp<IRemoteDisplayClient> &client,
31 const char *iface)
32 : mLooper(new ALooper),
33 mNetSession(new ANetworkSession) {
34 mLooper->setName("wfd_looper");
35
36 mSource = new WifiDisplaySource(opPackageName, mNetSession, client);
37 mLooper->registerHandler(mSource);
38
39 mNetSession->start();
40 mLooper->start();
41
42 mSource->start(iface);
43}
44
45RemoteDisplay::~RemoteDisplay() {
46}
47
48status_t RemoteDisplay::pause() {
49 return mSource->pause();
50}
51
52status_t RemoteDisplay::resume() {
53 return mSource->resume();
54}
55
56status_t RemoteDisplay::dispose() {
57 mSource->stop();
58 mSource.clear();
59
60 mLooper->stop();
61 mNetSession->stop();
62
63 return OK;
64}
65
66} // namespace android