OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media_stream_impl.h" | 5 #include "content/renderer/media/media_stream_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "content/renderer/media/media_stream_dependency_factory.h" | 13 #include "content/renderer/media/media_stream_dependency_factory.h" |
14 #include "content/renderer/media/media_stream_dispatcher.h" | 14 #include "content/renderer/media/media_stream_dispatcher.h" |
15 #include "content/renderer/media/media_stream_extra_data.h" | 15 #include "content/renderer/media/media_stream_extra_data.h" |
16 #include "content/renderer/media/media_stream_source_extra_data.h" | 16 #include "content/renderer/media/media_stream_source_extra_data.h" |
17 #include "content/renderer/media/rtc_video_decoder.h" | |
18 #include "content/renderer/media/rtc_video_renderer.h" | 17 #include "content/renderer/media/rtc_video_renderer.h" |
19 #include "content/renderer/media/video_capture_impl_manager.h" | 18 #include "content/renderer/media/video_capture_impl_manager.h" |
20 #include "content/renderer/media/webrtc_audio_capturer.h" | 19 #include "content/renderer/media/webrtc_audio_capturer.h" |
21 #include "content/renderer/media/webrtc_audio_renderer.h" | 20 #include "content/renderer/media/webrtc_audio_renderer.h" |
22 #include "content/renderer/media/webrtc_local_audio_renderer.h" | 21 #include "content/renderer/media/webrtc_local_audio_renderer.h" |
23 #include "content/renderer/media/webrtc_uma_histograms.h" | 22 #include "content/renderer/media/webrtc_uma_histograms.h" |
23 #include "media/base/video_decoder.h" | |
Ami GONE FROM CHROMIUM
2013/02/26 23:16:55
drop if GVD() goes away below
wuchengli
2013/02/27 01:45:41
Removed.
| |
24 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" | 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaConstraints .h" |
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" | 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc e.h" |
26 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" | 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack .h" |
27 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaStreamRegistr y.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaStreamRegistr y.h" |
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
32 #include "webkit/media/media_stream_audio_renderer.h" | 32 #include "webkit/media/media_stream_audio_renderer.h" |
33 | 33 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 DVLOG(1) << "MediaStreamImpl::GetVideoFrameProvider stream:" | 241 DVLOG(1) << "MediaStreamImpl::GetVideoFrameProvider stream:" |
242 << UTF16ToUTF8(descriptor.label()); | 242 << UTF16ToUTF8(descriptor.label()); |
243 | 243 |
244 webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor); | 244 webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor); |
245 if (stream) | 245 if (stream) |
246 return CreateVideoFrameProvider(stream, error_cb, repaint_cb); | 246 return CreateVideoFrameProvider(stream, error_cb, repaint_cb); |
247 NOTREACHED(); | 247 NOTREACHED(); |
248 return NULL; | 248 return NULL; |
249 } | 249 } |
250 | 250 |
251 scoped_refptr<media::VideoDecoder> MediaStreamImpl::GetVideoDecoder( | 251 scoped_refptr<media::VideoDecoder> MediaStreamImpl::GetVideoDecoder( |
Ami GONE FROM CHROMIUM
2013/02/26 23:16:55
Why not delete this method?
wuchengli
2013/02/27 01:45:41
Removed.
| |
252 const GURL& url, | 252 const GURL& url, |
253 const scoped_refptr<base::MessageLoopProxy>& message_loop) { | 253 const scoped_refptr<base::MessageLoopProxy>& message_loop) { |
254 DCHECK(CalledOnValidThread()); | |
255 WebKit::WebMediaStream descriptor(GetMediaStream(url)); | |
256 | |
257 if (descriptor.isNull() || !descriptor.extraData()) | |
258 return NULL; // This is not a valid stream. | |
259 | |
260 DVLOG(1) << "MediaStreamImpl::GetVideoDecoder stream:" | |
261 << UTF16ToUTF8(descriptor.label()); | |
262 | |
263 webrtc::MediaStreamInterface* stream = GetNativeMediaStream(descriptor); | |
264 if (stream) | |
265 return CreateVideoDecoder(stream, message_loop); | |
266 NOTREACHED(); | |
267 return NULL; | 254 return NULL; |
268 } | 255 } |
269 | 256 |
270 scoped_refptr<webkit_media::MediaStreamAudioRenderer> | 257 scoped_refptr<webkit_media::MediaStreamAudioRenderer> |
271 MediaStreamImpl::GetAudioRenderer(const GURL& url) { | 258 MediaStreamImpl::GetAudioRenderer(const GURL& url) { |
272 DCHECK(CalledOnValidThread()); | 259 DCHECK(CalledOnValidThread()); |
273 WebKit::WebMediaStream descriptor(GetMediaStream(url)); | 260 WebKit::WebMediaStream descriptor(GetMediaStream(url)); |
274 | 261 |
275 if (descriptor.isNull() || !descriptor.extraData()) | 262 if (descriptor.isNull() || !descriptor.extraData()) |
276 return NULL; // This is not a valid stream. | 263 return NULL; // This is not a valid stream. |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
530 | 517 |
531 DVLOG(1) << "MediaStreamImpl::CreateRemoteVideoFrameProvider label:" | 518 DVLOG(1) << "MediaStreamImpl::CreateRemoteVideoFrameProvider label:" |
532 << stream->label(); | 519 << stream->label(); |
533 | 520 |
534 return new RTCVideoRenderer( | 521 return new RTCVideoRenderer( |
535 stream->GetVideoTracks()[0], | 522 stream->GetVideoTracks()[0], |
536 error_cb, | 523 error_cb, |
537 repaint_cb); | 524 repaint_cb); |
538 } | 525 } |
539 | 526 |
540 scoped_refptr<media::VideoDecoder> MediaStreamImpl::CreateVideoDecoder( | |
541 webrtc::MediaStreamInterface* stream, | |
542 const scoped_refptr<base::MessageLoopProxy>& message_loop) { | |
543 if (stream->GetVideoTracks().empty()) | |
544 return NULL; | |
545 | |
546 | |
547 DVLOG(1) << "MediaStreamImpl::CreateRemoteVideoDecoder label:" | |
548 << stream->label(); | |
549 | |
550 return new RTCVideoDecoder( | |
551 message_loop, | |
552 base::MessageLoopProxy::current(), | |
553 stream->GetVideoTracks()[0].get()); | |
554 } | |
555 | |
556 scoped_refptr<WebRtcAudioRenderer> MediaStreamImpl::CreateRemoteAudioRenderer( | 527 scoped_refptr<WebRtcAudioRenderer> MediaStreamImpl::CreateRemoteAudioRenderer( |
557 webrtc::MediaStreamInterface* stream) { | 528 webrtc::MediaStreamInterface* stream) { |
558 if (stream->GetAudioTracks().empty()) | 529 if (stream->GetAudioTracks().empty()) |
559 return NULL; | 530 return NULL; |
560 | 531 |
561 DVLOG(1) << "MediaStreamImpl::CreateRemoteAudioRenderer label:" | 532 DVLOG(1) << "MediaStreamImpl::CreateRemoteAudioRenderer label:" |
562 << stream->label(); | 533 << stream->label(); |
563 | 534 |
564 return new WebRtcAudioRenderer(RenderViewObserver::routing_id()); | 535 return new WebRtcAudioRenderer(RenderViewObserver::routing_id()); |
565 } | 536 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
609 const StreamStopCallback& stop_callback) { | 580 const StreamStopCallback& stop_callback) { |
610 stream_stop_callback_ = stop_callback; | 581 stream_stop_callback_ = stop_callback; |
611 } | 582 } |
612 | 583 |
613 void MediaStreamExtraData::OnLocalStreamStop() { | 584 void MediaStreamExtraData::OnLocalStreamStop() { |
614 if (!stream_stop_callback_.is_null()) | 585 if (!stream_stop_callback_.is_null()) |
615 stream_stop_callback_.Run(stream_->label()); | 586 stream_stop_callback_.Run(stream_->label()); |
616 } | 587 } |
617 | 588 |
618 } // namespace content | 589 } // namespace content |
OLD | NEW |