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