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/webmediaplayer_impl.h" | 5 #include "content/renderer/media/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ | 113 #define COMPILE_ASSERT_MATCHING_ENUM(name) \ |
114 COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \ | 114 COMPILE_ASSERT(static_cast<int>(WebMediaPlayer::CORSMode ## name) == \ |
115 static_cast<int>(BufferedResourceLoader::k ## name), \ | 115 static_cast<int>(BufferedResourceLoader::k ## name), \ |
116 mismatching_enums) | 116 mismatching_enums) |
117 COMPILE_ASSERT_MATCHING_ENUM(Unspecified); | 117 COMPILE_ASSERT_MATCHING_ENUM(Unspecified); |
118 COMPILE_ASSERT_MATCHING_ENUM(Anonymous); | 118 COMPILE_ASSERT_MATCHING_ENUM(Anonymous); |
119 COMPILE_ASSERT_MATCHING_ENUM(UseCredentials); | 119 COMPILE_ASSERT_MATCHING_ENUM(UseCredentials); |
120 #undef COMPILE_ASSERT_MATCHING_ENUM | 120 #undef COMPILE_ASSERT_MATCHING_ENUM |
121 | 121 |
122 #define BIND_TO_RENDER_LOOP(function) \ | 122 #define BIND_TO_RENDER_LOOP(function) \ |
123 media::BindToLoop(main_loop_, base::Bind(function, AsWeakPtr())) | 123 (DCHECK(main_loop_->BelongsToCurrentThread()), \ |
124 | 124 media::BindToCurrentLoop(base::Bind(function, AsWeakPtr()))) |
125 #define BIND_TO_RENDER_LOOP_1(function, arg1) \ | |
126 media::BindToLoop(main_loop_, base::Bind(function, AsWeakPtr(), arg1)) | |
127 | |
128 #define BIND_TO_RENDER_LOOP_2(function, arg1, arg2) \ | |
129 media::BindToLoop(main_loop_, base::Bind(function, AsWeakPtr(), arg1, arg2)) | |
130 | 125 |
131 static void LogMediaSourceError(const scoped_refptr<media::MediaLog>& media_log, | 126 static void LogMediaSourceError(const scoped_refptr<media::MediaLog>& media_log, |
132 const std::string& error) { | 127 const std::string& error) { |
133 media_log->AddEvent(media_log->CreateMediaSourceErrorEvent(error)); | 128 media_log->AddEvent(media_log->CreateMediaSourceErrorEvent(error)); |
134 } | 129 } |
135 | 130 |
136 WebMediaPlayerImpl::WebMediaPlayerImpl( | 131 WebMediaPlayerImpl::WebMediaPlayerImpl( |
137 content::RenderView* render_view, | 132 content::RenderView* render_view, |
138 blink::WebFrame* frame, | 133 blink::WebFrame* frame, |
139 blink::WebMediaPlayerClient* client, | 134 blink::WebMediaPlayerClient* client, |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 SetNetworkState(WebMediaPlayer::NetworkStateIdle); | 1073 SetNetworkState(WebMediaPlayer::NetworkStateIdle); |
1079 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) | 1074 else if (is_downloading && network_state_ == WebMediaPlayer::NetworkStateIdle) |
1080 SetNetworkState(WebMediaPlayer::NetworkStateLoading); | 1075 SetNetworkState(WebMediaPlayer::NetworkStateLoading); |
1081 media_log_->AddEvent( | 1076 media_log_->AddEvent( |
1082 media_log_->CreateBooleanEvent( | 1077 media_log_->CreateBooleanEvent( |
1083 media::MediaLogEvent::NETWORK_ACTIVITY_SET, | 1078 media::MediaLogEvent::NETWORK_ACTIVITY_SET, |
1084 "is_downloading_data", is_downloading)); | 1079 "is_downloading_data", is_downloading)); |
1085 } | 1080 } |
1086 | 1081 |
1087 void WebMediaPlayerImpl::StartPipeline() { | 1082 void WebMediaPlayerImpl::StartPipeline() { |
| 1083 DCHECK(main_loop_->BelongsToCurrentThread()); |
1088 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); | 1084 const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); |
1089 | 1085 |
1090 // Keep track if this is a MSE or non-MSE playback. | 1086 // Keep track if this is a MSE or non-MSE playback. |
1091 UMA_HISTOGRAM_BOOLEAN("Media.MSE.Playback", | 1087 UMA_HISTOGRAM_BOOLEAN("Media.MSE.Playback", |
1092 (load_type_ == LoadTypeMediaSource)); | 1088 (load_type_ == LoadTypeMediaSource)); |
1093 | 1089 |
1094 // Figure out which demuxer to use. | 1090 // Figure out which demuxer to use. |
1095 if (load_type_ != LoadTypeMediaSource) { | 1091 if (load_type_ != LoadTypeMediaSource) { |
1096 DCHECK(!chunk_demuxer_); | 1092 DCHECK(!chunk_demuxer_); |
1097 DCHECK(data_source_); | 1093 DCHECK(data_source_); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1312 // The |current_frame_| wasn't painted, it is being replaced, and we haven't | 1308 // The |current_frame_| wasn't painted, it is being replaced, and we haven't |
1313 // even gotten the chance to request a repaint for it yet. Mark it as dropped. | 1309 // even gotten the chance to request a repaint for it yet. Mark it as dropped. |
1314 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); | 1310 TRACE_EVENT0("media", "WebMediaPlayerImpl:frameDropped"); |
1315 DVLOG(1) << "Frame dropped before being painted: " | 1311 DVLOG(1) << "Frame dropped before being painted: " |
1316 << current_frame_->GetTimestamp().InSecondsF(); | 1312 << current_frame_->GetTimestamp().InSecondsF(); |
1317 if (frames_dropped_before_paint_ < kuint32max) | 1313 if (frames_dropped_before_paint_ < kuint32max) |
1318 frames_dropped_before_paint_++; | 1314 frames_dropped_before_paint_++; |
1319 } | 1315 } |
1320 | 1316 |
1321 } // namespace content | 1317 } // namespace content |
OLD | NEW |