Files
android/proprietary/wvm/WVMInfoListener.cpp
Jeffrey Tinker 18617b93c6 fix for b/4126624 Widevine DRM client not sending heartbeats
Added some missing parameters to the heartbeat message, found in end-to-end
testing with youtube.  Also enabled heartbeats on client builds.

Change-Id: I445fb0cb168e63a041f0ecf828eaad493143a648
2011-03-25 14:02:08 -07:00

72 lines
2.2 KiB
C++

/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "WVMInfoListener"
#include <utils/Log.h>
#include "WVMExtractorImpl.h"
#include "WVMMediaSource.h"
#include "WVMFileSource.h"
#include "WVMInfoListener.h"
#include "WVMLogging.h"
#include "WVStreamControlAPI.h"
#include "media/stagefright/MediaErrors.h"
#include "media/stagefright/MediaDefs.h"
#include "drm/DrmInfoEvent.h"
namespace android {
void WVMInfoListener::setSession(WVSession *session)
{
mSession = session;
}
void WVMInfoListener::onInfo(const DrmInfoEvent &event)
{
//LOGD("WVMMediaSource::onInfo: type=%d, msg=%s!!!",
// event.getType(), event.getMessage().string());
if (event.getType() == MessageType_HeartbeatServer)
mServerUrl = event.getMessage();
else if (event.getType() == MessageType_HeartbeatPeriod)
mPeriod = atoi(event.getMessage());
else if (event.getType() == MessageType_AssetId)
mAssetId = atoi(event.getMessage());
else if (event.getType() == MessageType_DeviceId)
mDeviceId = event.getMessage();
else if (event.getType() == MessageType_StreamId)
mStreamId = event.getMessage();
else if (event.getType() == MessageType_UserData) {
mUserData = event.getMessage();
mHaveInfo = true;
}
}
void WVMInfoListener::configureHeartbeat()
{
// send the first time we have all the info
if (mSession && mHaveInfo) {
//LOGD("WVMMediaSource::calling WV_ConfigureHeartbeat()");
WV_ConfigureHeartbeat(mSession, mServerUrl, mPeriod, mAssetId,
mDeviceId, mStreamId, mUserData);
mSession = NULL;
}
}
};