OLD | NEW |
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 "content/renderer/media/android/webmediaplayer_android.h" | 5 #include "content/renderer/media/android/webmediaplayer_android.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 const std::string& remote_playback_message) { | 1143 const std::string& remote_playback_message) { |
1144 DCHECK(main_thread_checker_.CalledOnValidThread()); | 1144 DCHECK(main_thread_checker_.CalledOnValidThread()); |
1145 if (!video_weblayer_) | 1145 if (!video_weblayer_) |
1146 return; | 1146 return; |
1147 | 1147 |
1148 // TODO(johnme): Should redraw this frame if the layer bounds change; but | 1148 // TODO(johnme): Should redraw this frame if the layer bounds change; but |
1149 // there seems no easy way to listen for the layer resizing (as opposed to | 1149 // there seems no easy way to listen for the layer resizing (as opposed to |
1150 // OnVideoSizeChanged, which is when the frame sizes of the video file | 1150 // OnVideoSizeChanged, which is when the frame sizes of the video file |
1151 // change). Perhaps have to poll (on main thread of course)? | 1151 // change). Perhaps have to poll (on main thread of course)? |
1152 gfx::Size video_size_css_px = video_weblayer_->bounds(); | 1152 gfx::Size video_size_css_px = video_weblayer_->bounds(); |
1153 float device_scale_factor = frame_->view()->deviceScaleFactor(); | 1153 RenderView* render_view = RenderView::FromWebView(frame_->view()); |
| 1154 float device_scale_factor = render_view->GetDeviceScaleFactor(); |
1154 // canvas_size will be the size in device pixels when pageScaleFactor == 1 | 1155 // canvas_size will be the size in device pixels when pageScaleFactor == 1 |
1155 gfx::Size canvas_size( | 1156 gfx::Size canvas_size( |
1156 static_cast<int>(video_size_css_px.width() * device_scale_factor), | 1157 static_cast<int>(video_size_css_px.width() * device_scale_factor), |
1157 static_cast<int>(video_size_css_px.height() * device_scale_factor)); | 1158 static_cast<int>(video_size_css_px.height() * device_scale_factor)); |
1158 | 1159 |
1159 SkBitmap bitmap; | 1160 SkBitmap bitmap; |
1160 bitmap.allocN32Pixels(canvas_size.width(), canvas_size.height()); | 1161 bitmap.allocN32Pixels(canvas_size.width(), canvas_size.height()); |
1161 | 1162 |
1162 // Create the canvas and draw the "Casting to <Chromecast>" text on it. | 1163 // Create the canvas and draw the "Casting to <Chromecast>" text on it. |
1163 SkCanvas canvas(bitmap); | 1164 SkCanvas canvas(bitmap); |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1953 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; | 1954 result = PREDICTION_RESULT_PATH_BASED_WAS_BETTER; |
1954 } else if (is_hls_url == is_hls) { | 1955 } else if (is_hls_url == is_hls) { |
1955 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; | 1956 result = PREDICTION_RESULT_URL_BASED_WAS_BETTER; |
1956 } | 1957 } |
1957 UMA_HISTOGRAM_ENUMERATION( | 1958 UMA_HISTOGRAM_ENUMERATION( |
1958 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", | 1959 "Media.Android.IsHttpLiveStreamingMediaPredictionResult", |
1959 result, PREDICTION_RESULT_MAX); | 1960 result, PREDICTION_RESULT_MAX); |
1960 } | 1961 } |
1961 | 1962 |
1962 } // namespace content | 1963 } // namespace content |
OLD | NEW |