| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 total_frame_count_(0), | 136 total_frame_count_(0), |
| 137 dropped_frame_count_(0), | 137 dropped_frame_count_(0), |
| 138 stopped_(true) { | 138 stopped_(true) { |
| 139 main_message_loop_ = base::MessageLoop::current(); | 139 main_message_loop_ = base::MessageLoop::current(); |
| 140 io_thread_checker_.DetachFromThread(); | 140 io_thread_checker_.DetachFromThread(); |
| 141 | 141 |
| 142 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; | 142 blink::WebVector<blink::WebMediaStreamTrack> video_tracks; |
| 143 if (!web_stream.isNull()) | 143 if (!web_stream.isNull()) |
| 144 web_stream.videoTracks(video_tracks); | 144 web_stream.videoTracks(video_tracks); |
| 145 | 145 |
| 146 const bool remote_video = | 146 if (video_tracks.size() > 0 && |
| 147 video_tracks.size() && video_tracks[0].source().remote(); | |
| 148 | |
| 149 if (remote_video && | |
| 150 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 147 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 151 switches::kDisableRTCSmoothnessAlgorithm)) { | 148 switches::kDisableRTCSmoothnessAlgorithm)) { |
| 152 base::AutoLock auto_lock(current_frame_lock_); | 149 base::AutoLock auto_lock(current_frame_lock_); |
| 153 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( | 150 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( |
| 154 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, | 151 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, |
| 155 base::Unretained(this)))); | 152 base::Unretained(this)))); |
| 156 } | 153 } |
| 157 | 154 |
| 158 // Just for logging purpose. | 155 // Just for logging purpose. |
| 159 std::string stream_id = | 156 std::string stream_id = |
| 160 web_stream.isNull() ? std::string() : web_stream.id().utf8(); | 157 web_stream.isNull() ? std::string() : web_stream.id().utf8(); |
| 161 const uint32_t hash_value = base::Hash(stream_id); | 158 serial_ = base::Hash(stream_id);; |
| 162 serial_ = (hash_value << 1) | (remote_video ? 1 : 0); | |
| 163 } | 159 } |
| 164 | 160 |
| 165 WebMediaPlayerMSCompositor::~WebMediaPlayerMSCompositor() { | 161 WebMediaPlayerMSCompositor::~WebMediaPlayerMSCompositor() { |
| 166 DCHECK(!video_frame_provider_client_) | 162 DCHECK(!video_frame_provider_client_) |
| 167 << "Must call StopUsingProvider() before dtor!"; | 163 << "Must call StopUsingProvider() before dtor!"; |
| 168 } | 164 } |
| 169 | 165 |
| 170 gfx::Size WebMediaPlayerMSCompositor::GetCurrentSize() { | 166 gfx::Size WebMediaPlayerMSCompositor::GetCurrentSize() { |
| 171 DCHECK(thread_checker_.CalledOnValidThread()); | 167 DCHECK(thread_checker_.CalledOnValidThread()); |
| 172 base::AutoLock auto_lock(current_frame_lock_); | 168 base::AutoLock auto_lock(current_frame_lock_); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 } | 449 } |
| 454 | 450 |
| 455 if (!rendering_frame_buffer_) { | 451 if (!rendering_frame_buffer_) { |
| 456 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( | 452 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( |
| 457 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, | 453 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, |
| 458 base::Unretained(this)))); | 454 base::Unretained(this)))); |
| 459 } | 455 } |
| 460 } | 456 } |
| 461 | 457 |
| 462 } // namespace content | 458 } // namespace content |
| OLD | NEW |