Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/media_stream_remote_video_source.h" | 5 #include "content/renderer/media/webrtc/media_stream_remote_video_source.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/location.h" | 12 #include "base/location.h" |
| 13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 14 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 15 #include "content/renderer/media/webrtc/track_observer.h" | 15 #include "content/renderer/media/webrtc/track_observer.h" |
| 16 #include "media/base/bind_to_current_loop.h" | 16 #include "media/base/bind_to_current_loop.h" |
| 17 #include "media/base/timestamp_constants.h" | 17 #include "media/base/timestamp_constants.h" |
| 18 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
| 19 #include "media/base/video_util.h" | 19 #include "media/base/video_util.h" |
| 20 #include "third_party/webrtc/media/base/videoframe.h" | 20 #include "third_party/webrtc/media/base/videoframe.h" |
| 21 #include "third_party/webrtc/media/base/videosinkinterface.h" | 21 #include "third_party/webrtc/media/base/videosinkinterface.h" |
| 22 #include "third_party/webrtc/system_wrappers/include/tick_util.h" | |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| 25 | 24 |
| 26 // Internal class used for receiving frames from the webrtc track on a | 25 // Internal class used for receiving frames from the webrtc track on a |
| 27 // libjingle thread and forward it to the IO-thread. | 26 // libjingle thread and forward it to the IO-thread. |
| 28 class MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate | 27 class MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate |
| 29 : public base::RefCountedThreadSafe<RemoteVideoSourceDelegate>, | 28 : public base::RefCountedThreadSafe<RemoteVideoSourceDelegate>, |
| 30 public rtc::VideoSinkInterface<cricket::VideoFrame> { | 29 public rtc::VideoSinkInterface<cricket::VideoFrame> { |
| 31 public: | 30 public: |
| 32 RemoteVideoSourceDelegate( | 31 RemoteVideoSourceDelegate( |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 63 MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate:: | 62 MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate:: |
| 64 RemoteVideoSourceDelegate( | 63 RemoteVideoSourceDelegate( |
| 65 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 64 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 66 const VideoCaptureDeliverFrameCB& new_frame_callback) | 65 const VideoCaptureDeliverFrameCB& new_frame_callback) |
| 67 : io_task_runner_(io_task_runner), | 66 : io_task_runner_(io_task_runner), |
| 68 frame_callback_(new_frame_callback), | 67 frame_callback_(new_frame_callback), |
| 69 start_timestamp_(media::kNoTimestamp()), | 68 start_timestamp_(media::kNoTimestamp()), |
| 70 // TODO(qiangchen): There can be two differences between clocks: 1) | 69 // TODO(qiangchen): There can be two differences between clocks: 1) |
| 71 // the offset, 2) the rate (i.e., one clock runs faster than the other). | 70 // the offset, 2) the rate (i.e., one clock runs faster than the other). |
| 72 // See http://crbug/516700 | 71 // See http://crbug/516700 |
| 73 time_diff_(base::TimeTicks::Now() - base::TimeTicks() - | 72 time_diff_(base::TimeTicks::Now() - base::TimeTicks() - |
|
perkj_webrtc
2016/04/14 13:46:23
Isn't all these methods from the same clock in the
nisse-webrtc
2016/04/19 11:12:41
I haven't yet tried to understand time sources in
| |
| 74 base::TimeDelta::FromMicroseconds( | 73 base::TimeDelta::FromMicroseconds(rtc::TimeMicros())) {} |
| 75 webrtc::TickTime::MicrosecondTimestamp())) {} | |
| 76 | 74 |
| 77 MediaStreamRemoteVideoSource:: | 75 MediaStreamRemoteVideoSource:: |
| 78 RemoteVideoSourceDelegate::~RemoteVideoSourceDelegate() { | 76 RemoteVideoSourceDelegate::~RemoteVideoSourceDelegate() { |
| 79 } | 77 } |
| 80 | 78 |
| 81 void MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate::OnFrame( | 79 void MediaStreamRemoteVideoSource::RemoteVideoSourceDelegate::OnFrame( |
| 82 const cricket::VideoFrame& incoming_frame) { | 80 const cricket::VideoFrame& incoming_frame) { |
| 83 const base::TimeDelta incoming_timestamp = base::TimeDelta::FromMicroseconds( | 81 const base::TimeDelta incoming_timestamp = base::TimeDelta::FromMicroseconds( |
| 84 incoming_frame.GetTimeStamp() / rtc::kNumNanosecsPerMicrosec); | 82 incoming_frame.GetTimeStamp() / rtc::kNumNanosecsPerMicrosec); |
| 85 const base::TimeTicks render_time = | 83 const base::TimeTicks render_time = |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 case webrtc::MediaStreamTrackInterface::kEnded: | 212 case webrtc::MediaStreamTrackInterface::kEnded: |
| 215 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); | 213 SetReadyState(blink::WebMediaStreamSource::ReadyStateEnded); |
| 216 break; | 214 break; |
| 217 default: | 215 default: |
| 218 NOTREACHED(); | 216 NOTREACHED(); |
| 219 break; | 217 break; |
| 220 } | 218 } |
| 221 } | 219 } |
| 222 | 220 |
| 223 } // namespace content | 221 } // namespace content |
| OLD | NEW |