Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2198403002: Account for video rotation in OnVideoNaturalSizeChange() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/blink/webmediaplayer_impl.h" 5 #include "media/blink/webmediaplayer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1120 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called 1120 // TODO(jrummell): didResumePlaybackBlockedForKey() should only be called
1121 // when a key has been successfully added (e.g. OnSessionKeysChange() with 1121 // when a key has been successfully added (e.g. OnSessionKeysChange() with
1122 // |has_additional_usable_key| = true). http://crbug.com/461903 1122 // |has_additional_usable_key| = true). http://crbug.com/461903
1123 encrypted_client_->didResumePlaybackBlockedForKey(); 1123 encrypted_client_->didResumePlaybackBlockedForKey();
1124 } 1124 }
1125 1125
1126 void WebMediaPlayerImpl::OnVideoNaturalSizeChange(const gfx::Size& size) { 1126 void WebMediaPlayerImpl::OnVideoNaturalSizeChange(const gfx::Size& size) {
1127 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1127 DCHECK(main_task_runner_->BelongsToCurrentThread());
1128 DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing); 1128 DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing);
1129 1129
1130 if (size == pipeline_metadata_.natural_size) 1130 gfx::Size rotated_size = size;
DaleCurtis 2016/08/01 23:32:51 Probably this should be deduped into a GetRotation
sandersd (OOO until July 31) 2016/08/01 23:55:19 Done.
1131 if (pipeline_metadata_.video_rotation == VIDEO_ROTATION_90 ||
1132 pipeline_metadata_.video_rotation == VIDEO_ROTATION_270) {
1133 rotated_size = gfx::Size(size.height(), size.width());
1134 }
1135
1136 if (rotated_size == pipeline_metadata_.natural_size)
1131 return; 1137 return;
1132 1138
1133 TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged"); 1139 TRACE_EVENT0("media", "WebMediaPlayerImpl::OnNaturalSizeChanged");
1134 media_log_->AddEvent( 1140 media_log_->AddEvent(media_log_->CreateVideoSizeSetEvent(
1135 media_log_->CreateVideoSizeSetEvent(size.width(), size.height())); 1141 rotated_size.width(), rotated_size.height()));
1136 1142
1137 if (overlay_enabled_ && surface_manager_) 1143 if (overlay_enabled_ && surface_manager_)
1138 surface_manager_->NaturalSizeChanged(size); 1144 surface_manager_->NaturalSizeChanged(rotated_size);
1139 1145
1140 pipeline_metadata_.natural_size = size; 1146 pipeline_metadata_.natural_size = rotated_size;
1141 client_->sizeChanged(); 1147 client_->sizeChanged();
1142 } 1148 }
1143 1149
1144 void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) { 1150 void WebMediaPlayerImpl::OnVideoOpacityChange(bool opaque) {
1145 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1151 DCHECK(main_task_runner_->BelongsToCurrentThread());
1146 DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing); 1152 DCHECK_NE(ready_state_, WebMediaPlayer::ReadyStateHaveNothing);
1147 1153
1148 opaque_ = opaque; 1154 opaque_ = opaque;
1149 // Modify content opaqueness of cc::Layer directly so that 1155 // Modify content opaqueness of cc::Layer directly so that
1150 // SetContentsOpaqueIsFixed is ignored. 1156 // SetContentsOpaqueIsFixed is ignored.
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 if (isRemote()) 1726 if (isRemote())
1721 return; 1727 return;
1722 #endif 1728 #endif
1723 1729
1724 // Idle timeout chosen arbitrarily. 1730 // Idle timeout chosen arbitrarily.
1725 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), 1731 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
1726 this, &WebMediaPlayerImpl::OnPause); 1732 this, &WebMediaPlayerImpl::OnPause);
1727 } 1733 }
1728 1734
1729 } // namespace media 1735 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698