renderer_extension_receiver_(this,
std::move(renderer_extension_receiver)),
web_contents_(web_contents) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
DCHECK_EQ(WebContents::FromRenderFrameHost(
RenderFrameHost::FromID(process_id, routing_id)),
web_contents);
video_rect_(gfx::RectF()),
#endif
renderer_extension_receiver_(this) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
// TODO(dalecurtis): Remove once experiments for http://crbug.com/470940 are
// complete.
int threshold_ms = 0;
}
TizenRendererImpl::~TizenRendererImpl() {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
weak_factory_.InvalidateWeakPtrs();
void TizenRendererImpl::Initialize(media::MediaResource* media_resource,
media::RendererClient* client,
media::PipelineStatusCallback init_cb) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
DCHECK_EQ(state_, STATE_UNINITIALIZED);
DCHECK(init_cb);
web_contents->GetRenderWidgetHostView())) {
view_aura->SetWebViewMovedCallback(base::BindRepeating(
&TizenRendererImpl::OnWebViewMoved, base::Unretained(this)));
- LOG(INFO) << "SetPositionMovedCallbacks called!";
+ LOG_ID(INFO, player_id_) << "SetPositionMovedCallbacks called!";
}
}
#endif
if (!media::MediaPlayerRegistry::GetInstance()->ActivateMediaPlayer(
player_id_, !resource_conflicted_)) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << " Can not initialize the player id: " << player_id_;
+ LOG_ID(INFO, player_id_)
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << " Can not initialize the player id: " << player_id_;
return;
}
void TizenRendererImpl::SetPlayerInitialize() {
if (media_player_->IsInitialized()) {
- LOG(INFO) << __func__ << " Already initialized.";
+ LOG_ID(INFO, player_id_) << __func__ << " Already initialized.";
return;
}
void TizenRendererImpl::SetPlayerPrepare() {
if (!media_player_->CanPrepare()) {
- LOG(INFO) << __func__ << " Already preparing or prepared.";
+ LOG_ID(INFO, player_id_) << __func__ << " Already preparing or prepared.";
return;
}
}
void TizenRendererImpl::Seek(base::TimeDelta time, base::OnceClosure seek_cb) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << " time : " << time.InMicroseconds();
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__ << " time : " << time.InMicroseconds();
media_player_->Seek(time, std::move(seek_cb));
}
void TizenRendererImpl::OnWebViewMoved() {
if (media_player_) {
- LOG(INFO) << __func__ << " Reset WebView-Position.";
+ LOG_ID(INFO, player_id_) << __func__ << " Reset WebView-Position.";
SetPlayerMediaGeometry();
}
}
}
void TizenRendererImpl::Suspend() {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
if (is_suspended_)
return;
if (!media_player_) {
- LOG(INFO) << "media_player_ is not created yet";
+ LOG_ID(INFO, player_id_) << "media_player_ is not created yet";
return;
}
const {
content::WebContents* web_contents = GetWebContents();
if (!web_contents) {
- LOG(ERROR) << "web_contents is nullptr";
+ LOG_ID(ERROR, player_id_) << "web_contents is nullptr";
return nullptr;
}
return web_contents->GetDelegate();
}
void TizenRendererImpl::StartPlayingFrom(base::TimeDelta time) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << " time : " << time.InMicroseconds();
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__ << " time : " << time.InMicroseconds();
DCHECK(media_player_);
DCHECK(task_runner_->BelongsToCurrentThread());
TRACE_EVENT1("media", "TizenRendererImpl::StartPlayingFrom", "time_us",
}
void TizenRendererImpl::SetPlaybackRate(double playback_rate) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__ << " "
- << playback_rate << "/ " << playback_rate_;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__ << " " << playback_rate << "/ "
+ << playback_rate_;
DCHECK(task_runner_->BelongsToCurrentThread());
TRACE_EVENT1("media", "TizenRendererImpl::SetPlaybackRate", "rate",
playback_rate);
}
void TizenRendererImpl::SetVolume(float volume) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
DCHECK(task_runner_->BelongsToCurrentThread());
if (volume_ == volume)
return;
if (media_player_)
media_player_->SetParentalRatingResult(is_pass);
else
- LOG(ERROR) << "media_player_ is null";
+ LOG_ID(ERROR, player_id_) << "media_player_ is null";
}
bool TizenRendererImpl::PlaybackNotificationEnabled() {
content::WebContents* web_contents = GetWebContents();
if (!web_contents) {
- LOG(ERROR) << "web_contents is nullptr";
+ LOG_ID(ERROR, player_id_) << "web_contents is nullptr";
return false;
}
blink::web_pref::WebPreferences web_preference =
web_contents->GetOrCreateWebPreferences();
bool enable = web_preference.media_playback_notification_enabled;
- LOG(INFO) << "media_playback_notification_enabled:" << enable;
+ LOG_ID(INFO, player_id_) << "media_playback_notification_enabled:" << enable;
return enable;
}
content::WebContentsDelegate* web_contents_delegate =
GetWebContentsDelegate();
if (!web_contents_delegate) {
- LOG(ERROR) << "GetWebContentsDelegate failed";
+ LOG_ID(ERROR, player_id_) << "GetWebContentsDelegate failed";
return;
}
if (notify_playback_state_ < media::kPlaybackReady &&
state == media::kPlaybackStop) {
- LOG(ERROR) << "player not Ready but notify Stop";
+ LOG_ID(ERROR, player_id_) << "player not Ready but notify Stop";
}
notify_playback_state_ = state;
}
void TizenRendererImpl::OnRequestSuspend(bool resource_conflicted) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, player_id_) << "(" << static_cast<void*>(this) << ") "
+ << __func__;
if (is_suspended_) {
- LOG(INFO) << " Media is already suspended.";
+ LOG_ID(INFO, player_id_) << " Media is already suspended.";
return;
}
const std::string& user_agent,
double volume)
: MediaPlayerBridgeCapi(url, user_agent, volume), weak_factory_(this) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__;
}
MediaPlayerBridgeCapiTV::~MediaPlayerBridgeCapiTV() {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__;
weak_factory_.InvalidateWeakPtrs();
}
void MediaPlayerBridgeCapiTV::SetContentMimeType(const std::string& mime_type) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << " mime_type : " << mime_type;
+ LOG_ID(INFO, GetPlayerId()) << "(" << static_cast<void*>(this) << ") "
+ << __func__ << " mime_type : " << mime_type;
mime_type_ = mime_type;
}
kPlaybackLoad, player_id_, url_.spec(), mime_type_,
&media_resource_acquired, &translated_url, &drm_info);
- LOG(INFO) << "media_resource_acquired: " << media_resource_acquired
- << ",translated_url:" << translated_url
- << ",drm_info: " << drm_info;
+ LOG_ID(INFO, GetPlayerId())
+ << "media_resource_acquired: " << media_resource_acquired
+ << ",translated_url:" << translated_url << ",drm_info: " << drm_info;
if (mime_type_.find("application/vnd.oipf.contentaccessstreaming+xml") !=
std::string::npos) {
- LOG(INFO) << "CASD url,waiting for hbbtv parse the real url and set "
- "translated url";
+ LOG_ID(INFO, GetPlayerId())
+ << "CASD url,waiting for hbbtv parse the real url and set "
+ "translated url";
return;
}
GetMediaPlayerClient()->PlaybackNotificationEnabled() &&
blink::IsHbbTV()) {
if (!SetDrmInfo(drm_info)) {
- LOG(ERROR) << "SetDrmInfo failed";
+ LOG_ID(ERROR, GetPlayerId()) << "SetDrmInfo failed";
return;
}
if (!translated_url.empty())
}
bool MediaPlayerBridgeCapiTV::Play() {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << ",current_time:" << GetCurrentTime().InSecondsF();
+ LOG_ID(INFO, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << ",current_time:" << GetCurrentTime().InSecondsF();
// HBBTV run in preloading and preplay mode. If no prepread do prepare
// in PlayerPrePlay(), otherwise do normal Play.
if (blink::IsHbbTV() && !player_prepared_) {
if (!PlayerPrePlay())
- LOG(ERROR) << "HBBTV prePlay fail.";
+ LOG_ID(ERROR, GetPlayerId()) << "HBBTV prePlay fail.";
return false;
}
if (blink::IsHbbTV() && !parental_rating_pass_) {
- LOG(INFO) << "parental rating authenticatoin is not pass yet,waiting...";
+ LOG_ID(INFO, GetPlayerId())
+ << "parental rating authenticatoin is not pass yet,waiting...";
delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
MediaPlayerBridgeCapi::ExecuteDelayedPlayerState();
return false;
void MediaPlayerBridgeCapiTV::Pause(bool is_media_related_action) {
if (!player_prepared_) {
- LOG(INFO) << "(" << static_cast<void*>(this)
- << "), pause while player is not prepared, pause delay";
+ LOG_ID(INFO, GetPlayerId())
+ << "(" << static_cast<void*>(this)
+ << "), pause while player is not prepared, pause delay";
delayed_player_state_ = PLAYER_STATE_DELAYED_PAUSE;
return;
}
void MediaPlayerBridgeCapiTV::GetAdaptiveStreamingInfo() {
int ret = player_get_adaptive_streaming_info(player_, &is_live_stream_,
PLAYER_ADAPTIVE_INFO_IS_LIVE);
- if (ret == PLAYER_ERROR_NONE && is_live_stream_) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << " A live stream.";
+ if (ret != PLAYER_ERROR_NONE || is_live_stream_) {
+ LOG_ID(INFO, GetPlayerId()) << "(" << static_cast<void*>(this) << ") "
+ << __func__ << " A live stream.";
}
}
GetAdaptiveStreamingInfo();
if (!is_live_stream_) {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
- << " changed to static stream";
+ LOG_ID(INFO, GetPlayerId()) << "(" << static_cast<void*>(this) << ") "
+ << __func__ << " changed to static stream";
if (GetMediaPlayerClient())
GetMediaPlayerClient()->OnSeekableTimeChange({}, {}, is_live_stream_);
MediaPlayerBridgeCapi::UpdateDuration();
const std::string duration(live_duration);
const std::string::size_type delimiter = duration.find('|');
if (delimiter == std::string::npos) {
- LOG(ERROR) << "(" << static_cast<void*>(this) << ") " << __func__
- << " Failed to find delimiter | in duration: " << duration;
+ LOG_ID(ERROR, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << " Failed to find delimiter | in duration: " << duration;
return false;
}
const std::string duration_min = duration.substr(0, delimiter);
if (duration_min.empty()) {
- LOG(ERROR) << "(" << static_cast<void*>(this) << ") " << __func__
- << " Failed empty min sub str: " << duration << ", "
- << delimiter;
+ LOG_ID(ERROR, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << " Failed empty min sub str: " << duration << ", " << delimiter;
return false;
}
int64_t out_min = 0;
if (!base::StringToInt64(duration_min, &out_min)) {
- LOG(ERROR) << "(" << static_cast<void*>(this) << ") " << __func__
- << " Failed to get min from duration: " << duration;
+ LOG_ID(ERROR, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << " Failed to get min from duration: " << duration;
return false;
}
const std::string duration_max = duration.substr(delimiter + 1);
if (duration_max.empty()) {
- LOG(ERROR) << "(" << static_cast<void*>(this) << ") " << __func__
- << " empty max sub str: " << duration << ", " << delimiter;
+ LOG_ID(ERROR, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << " empty max sub str: " << duration << ", " << delimiter;
return false;
}
int64_t out_max = 0;
if (!base::StringToInt64(duration_max, &out_max)) {
- LOG(ERROR) << "(" << static_cast<void*>(this) << ") " << __func__
- << " Failed to get max from duration: " << duration;
+ LOG_ID(ERROR, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__
+ << " Failed to get max from duration: " << duration;
return false;
}
strncat(str_url, high_bitrate, strlen(high_bitrate));
hbbtv_url_ = str_url;
BLINKFREE(str_url);
- LOG(INFO) << "hbbtv url:" << hbbtv_url_.c_str();
+ LOG_ID(INFO, GetPlayerId()) << "hbbtv url:" << hbbtv_url_.c_str();
}
bool MediaPlayerBridgeCapiTV::CheckHighBitRate() {
if (!GetMediaPlayerClient()) {
- LOG(ERROR) << "MediaPlayerClient is null";
+ LOG_ID(ERROR, GetPlayerId()) << "MediaPlayerClient is null";
return false;
}
content::WebContentsDelegate* web_contents_delegate =
GetMediaPlayerClient()->GetWebContentsDelegate();
if (!web_contents_delegate) {
- LOG(ERROR) << "get web_contents_delegate fail";
+ LOG_ID(ERROR, GetPlayerId()) << "get web_contents_delegate fail";
return false;
}
bool ret = web_contents_delegate->IsHighBitRate();
- LOG(INFO) << "get high bit rate: " << std::boolalpha << ret;
+ LOG_ID(INFO, GetPlayerId()) << "get high bit rate: " << std::boolalpha << ret;
return ret;
}
}
bool MediaPlayerBridgeCapiTV::PreloadIfNeeded(int& ret) {
- LOG(INFO) << "PreloadIfNeeded, is_preloaded_ " << is_preloaded_;
+ LOG_ID(INFO, GetPlayerId())
+ << "PreloadIfNeeded, is_preloaded_ " << is_preloaded_;
if (blink::IsHbbTV() && !is_preloaded_) {
ret = player_preloading_async(player_, -1, PlayerPreLoadingCb, this);
return true;
if (GetMediaPlayerClient())
GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackReady, player_id_);
else
- LOG(ERROR) << "(" << static_cast<void*>(this)
- << "), GetMediaPlayerClient return null";
+ LOG_ID(ERROR, GetPlayerId()) << "(" << static_cast<void*>(this)
+ << "), GetMediaPlayerClient return null";
SetDisplayAtPausedState();
return false;
}
ret = player_display_video_at_paused_state(player_, true);
if (ret != PLAYER_ERROR_NONE)
- LOG(ERROR) << "player_display_video_at_paused_state() failed";
+ LOG_ID(ERROR, GetPlayerId())
+ << "player_display_video_at_paused_state() failed";
}
void MediaPlayerBridgeCapiTV::UpdateDuration() {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__;
if (blink::IsHbbTV() && !is_preloaded_) {
- LOG(INFO) << "HBBTV preload not finished, no need update duration. ";
+ LOG_ID(INFO, GetPlayerId())
+ << "HBBTV preload not finished, no need update duration. ";
return;
}
if (is_live_stream_) {
}
void MediaPlayerBridgeCapiTV::UpdateMediaType() {
- LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__;
+ LOG_ID(INFO, GetPlayerId())
+ << "(" << static_cast<void*>(this) << ") " << __func__;
if (blink::IsHbbTV() && !is_preloaded_) {
- LOG(INFO) << "HBBTV preload not finished, no need update media type. ";
+ LOG_ID(INFO, GetPlayerId())
+ << "HBBTV preload not finished, no need update media type. ";
return;
}
MediaPlayerBridgeCapi::UpdateMediaType();
bool MediaPlayerBridgeCapiTV::HBBTVResourceAcquired() {
bool media_resource_acquired = false;
if (!GetMediaPlayerClient()) {
- LOG(ERROR) << "MediaPlayerTizenClient is nullptr";
+ LOG_ID(ERROR, GetPlayerId()) << "MediaPlayerTizenClient is nullptr";
return false;
}
&media_resource_acquired, NULL, NULL);
if (!media_resource_acquired) {
GetMediaPlayerClient()->NotifyPlaybackState(kPlaybackStop, player_id_);
- LOG(ERROR) << "HBBTV media resource acquired failed";
+ LOG_ID(ERROR, GetPlayerId()) << "HBBTV media resource acquired failed";
}
return media_resource_acquired;
}
void MediaPlayerBridgeCapiTV::PlayerPreloaded() {
- LOG(INFO) << "PlayerPreloaded,this: " << this
- << ",player_prepared_:" << player_prepared_;
+ LOG_ID(INFO, GetPlayerId()) << "PlayerPreloaded,this: " << this
+ << ",player_prepared_:" << player_prepared_;
is_preloaded_ = true;
is_live_stream_ = CheckLiveStreaming();
UpdateDuration();
UpdateMediaType();
if (GetMediaType() == MediaType::Invalid) {
- LOG(ERROR) << "Media type is not valid!";
+ LOG_ID(ERROR, GetPlayerId()) << "Media type is not valid!";
return;
}
}
bool MediaPlayerBridgeCapiTV::PlayerPrePlay() {
- LOG(INFO) << "PlayerPrePlay, this: " << this
- << ",is_player_prepared : " << player_prepared_;
+ LOG_ID(INFO, GetPlayerId()) << "PlayerPrePlay, this: " << this
+ << ",is_player_prepared : " << player_prepared_;
if (IsPlayerSuspended()) {
- LOG(INFO) << "PlayerPrePlay while player is suspended";
+ LOG_ID(INFO, GetPlayerId()) << "PlayerPrePlay while player is suspended";
return false;
}
if (!HBBTVResourceAcquired()) {
- LOG(INFO)
+ LOG_ID(INFO, GetPlayerId())
<< "PlayerPrePlay while it's not in case of HBBTV Resource Acquired";
return false;
}
delayed_player_state_ = PLAYER_STATE_DELAYED_PLAY;
- LOG(INFO) << "begin to |player_prepare_async|";
+ LOG_ID(INFO, GetPlayerId()) << "begin to |player_prepare_async|";
SetDisplayAtPausedState();
int ret = SetPlayerPrepareAsync();
std::string trim_key = drm_info_pair.at(0);
std::string trim_value = drm_info_pair.at(1);
- LOG(INFO) << "trim_key: " << trim_key.c_str()
- << ",trim_value: " << trim_value.c_str();
+ LOG_ID(INFO, GetPlayerId()) << "trim_key: " << trim_key.c_str()
+ << ",trim_value: " << trim_value.c_str();
if (!SetMediaDRMInfo(trim_key, trim_value)) {
- LOG(ERROR)
+ LOG_ID(ERROR, GetPlayerId())
<< "MediaPlayerBridgeCapiTV::SetDrmInfo SetMediaDRMInfo failed";
return false;
}
bool MediaPlayerBridgeCapiTV::SetMediaDRMInfo(const std::string& type_data,
const std::string& value_data) {
- LOG(INFO) << "player_set_drm_info(type_length(" << type_data.length() << ") "
- << " value_length(" << value_data.length() << ")) ";
+ LOG_ID(INFO, GetPlayerId())
+ << "player_set_drm_info(type_length(" << type_data.length() << ") "
+ << " value_length(" << value_data.length() << ")) ";
int ret = PLAYER_ERROR_INVALID_OPERATION;
const void* type_data_ptr = type_data.c_str();
const void* value_data_ptr = value_data.c_str();
}
void MediaPlayerBridgeCapiTV::OnDrmError(int err_code, char* err_str) {
- LOG(ERROR) << "OnDrmError err_str[" << err_str << "]";
+ LOG_ID(ERROR, GetPlayerId()) << "OnDrmError err_str[" << err_str << "]";
if (!task_runner_->BelongsToCurrentThread()) {
task_runner_->PostTask(
FROM_HERE,
const std::string& url) {
content::WebContentsDelegate* web_contents_delegate =
GetMediaPlayerClient()->GetWebContentsDelegate();
- if (!web_contents_delegate){
- LOG(ERROR) << "web_contents_delegate is null";
+ if (!web_contents_delegate) {
+ LOG_ID(ERROR, GetPlayerId()) << "web_contents_delegate is null";
return;
}
web_contents_delegate->NotifyParentalRatingInfo(info, url);
}
void MediaPlayerBridgeCapiTV::SetParentalRatingResult(bool is_pass) {
- LOG(INFO) << "ParentalRatingResult:" << std::boolalpha << is_pass;
+ LOG_ID(INFO, GetPlayerId())
+ << "ParentalRatingResult:" << std::boolalpha << is_pass;
parental_rating_pass_ = is_pass;
// if authentication fail, raise MEDIA_ERROR_DECODE
}
if (player_prepared_) {
- LOG(INFO) << "player already prepared,execute play";
+ LOG_ID(INFO, GetPlayerId()) << "player already prepared,execute play";
ExecuteDelayedPlayerState();
}
}