Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ms_compositor.h" | 5 #include "content/renderer/media/webmediaplayer_ms_compositor.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 total_frame_count_(0), | 135 total_frame_count_(0), |
| 136 dropped_frame_count_(0), | 136 dropped_frame_count_(0), |
| 137 stopped_(true), | 137 stopped_(true), |
| 138 weak_ptr_factory_(this) { | 138 weak_ptr_factory_(this) { |
| 139 main_message_loop_ = base::MessageLoop::current(); | 139 main_message_loop_ = base::MessageLoop::current(); |
| 140 | 140 |
| 141 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | 141 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; |
| 142 if (!web_stream.isNull()) | 142 if (!web_stream.isNull()) |
| 143 web_stream.videoTracks(video_tracks); | 143 web_stream.videoTracks(video_tracks); |
| 144 | 144 |
| 145 const bool remote_video = | 145 if (video_tracks.size() > 0 && |
| 146 video_tracks.size() && video_tracks[0].source().remote(); | |
| 147 | |
| 148 if (remote_video && | |
| 149 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 146 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 150 switches::kDisableRTCSmoothnessAlgorithm)) { | 147 switches::kDisableRTCSmoothnessAlgorithm)) { |
| 151 base::AutoLock auto_lock(current_frame_lock_); | 148 base::AutoLock auto_lock(current_frame_lock_); |
| 152 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( | 149 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( |
| 153 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, | 150 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, |
| 154 base::Unretained(this)))); | 151 base::Unretained(this)))); |
| 155 } | 152 } |
| 156 | 153 |
| 157 // Just for logging purpose. | 154 // Just for logging purpose. |
| 158 std::string stream_id = | 155 std::string stream_id = |
| 159 web_stream.isNull() ? std::string() : web_stream.id().utf8(); | 156 web_stream.isNull() ? std::string() : web_stream.id().utf8(); |
| 160 const uint32_t hash_value = base::Hash(stream_id); | 157 const uint32_t hash_value = base::Hash(stream_id); |
| 161 serial_ = (hash_value << 1) | (remote_video ? 1 : 0); | 158 serial_ = (hash_value << 1) | ((video_tracks.size() > 0) ? 1 : 0); |
|
miu
2016/10/23 00:51:30
Looks like this should now be:
serial_ = base::
| |
| 162 } | 159 } |
| 163 | 160 |
| 164 WebMediaPlayerMSCompositor::~WebMediaPlayerMSCompositor() { | 161 WebMediaPlayerMSCompositor::~WebMediaPlayerMSCompositor() { |
| 165 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 162 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 166 if (video_frame_provider_client_) | 163 if (video_frame_provider_client_) |
| 167 video_frame_provider_client_->StopUsingProvider(); | 164 video_frame_provider_client_->StopUsingProvider(); |
| 168 } | 165 } |
| 169 | 166 |
| 170 gfx::Size WebMediaPlayerMSCompositor::GetCurrentSize() { | 167 gfx::Size WebMediaPlayerMSCompositor::GetCurrentSize() { |
| 171 DCHECK(thread_checker_.CalledOnValidThread()); | 168 DCHECK(thread_checker_.CalledOnValidThread()); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 } | 435 } |
| 439 | 436 |
| 440 if (!rendering_frame_buffer_) { | 437 if (!rendering_frame_buffer_) { |
| 441 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( | 438 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( |
| 442 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, | 439 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, |
| 443 base::Unretained(this)))); | 440 base::Unretained(this)))); |
| 444 } | 441 } |
| 445 } | 442 } |
| 446 | 443 |
| 447 } // namespace content | 444 } // namespace content |
| OLD | NEW |