OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include <vector> | 33 #include <vector> |
34 | 34 |
35 #include "talk/media/base/mediaengine.h" | 35 #include "talk/media/base/mediaengine.h" |
36 #include "talk/media/webrtc/webrtcvideochannelfactory.h" | 36 #include "talk/media/webrtc/webrtcvideochannelfactory.h" |
37 #include "talk/media/webrtc/webrtcvideodecoderfactory.h" | 37 #include "talk/media/webrtc/webrtcvideodecoderfactory.h" |
38 #include "talk/media/webrtc/webrtcvideoencoderfactory.h" | 38 #include "talk/media/webrtc/webrtcvideoencoderfactory.h" |
39 #include "webrtc/base/criticalsection.h" | 39 #include "webrtc/base/criticalsection.h" |
40 #include "webrtc/base/scoped_ptr.h" | 40 #include "webrtc/base/scoped_ptr.h" |
41 #include "webrtc/base/thread_annotations.h" | 41 #include "webrtc/base/thread_annotations.h" |
42 #include "webrtc/base/thread_checker.h" | 42 #include "webrtc/base/thread_checker.h" |
| 43 #include "webrtc/media/base/videosinkinterface.h" |
43 #include "webrtc/call.h" | 44 #include "webrtc/call.h" |
44 #include "webrtc/transport.h" | 45 #include "webrtc/transport.h" |
45 #include "webrtc/video_frame.h" | 46 #include "webrtc/video_frame.h" |
46 #include "webrtc/video_receive_stream.h" | 47 #include "webrtc/video_receive_stream.h" |
47 #include "webrtc/video_renderer.h" | 48 #include "webrtc/video_renderer.h" |
48 #include "webrtc/video_send_stream.h" | 49 #include "webrtc/video_send_stream.h" |
49 | 50 |
50 namespace webrtc { | 51 namespace webrtc { |
51 class VideoDecoder; | 52 class VideoDecoder; |
52 class VideoEncoder; | 53 class VideoEncoder; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // TODO(deadbeef): Move logic from SetRecvCodecs/SetRtpExtensions/etc. | 407 // TODO(deadbeef): Move logic from SetRecvCodecs/SetRtpExtensions/etc. |
407 // into this method. Currently this method only sets the RTCP mode. | 408 // into this method. Currently this method only sets the RTCP mode. |
408 void SetRecvParameters(const VideoRecvParameters& recv_params); | 409 void SetRecvParameters(const VideoRecvParameters& recv_params); |
409 | 410 |
410 void RenderFrame(const webrtc::VideoFrame& frame, | 411 void RenderFrame(const webrtc::VideoFrame& frame, |
411 int time_to_render_ms) override; | 412 int time_to_render_ms) override; |
412 bool IsTextureSupported() const override; | 413 bool IsTextureSupported() const override; |
413 bool SmoothsRenderedFrames() const override; | 414 bool SmoothsRenderedFrames() const override; |
414 bool IsDefaultStream() const; | 415 bool IsDefaultStream() const; |
415 | 416 |
416 void SetRenderer(cricket::VideoRenderer* renderer); | 417 void SetSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink); |
417 | 418 |
418 VideoReceiverInfo GetVideoReceiverInfo(); | 419 VideoReceiverInfo GetVideoReceiverInfo(); |
419 | 420 |
420 private: | 421 private: |
421 struct AllocatedDecoder { | 422 struct AllocatedDecoder { |
422 AllocatedDecoder(webrtc::VideoDecoder* decoder, | 423 AllocatedDecoder(webrtc::VideoDecoder* decoder, |
423 webrtc::VideoCodecType type, | 424 webrtc::VideoCodecType type, |
424 bool external); | 425 bool external); |
425 webrtc::VideoDecoder* decoder; | 426 webrtc::VideoDecoder* decoder; |
426 // Decoder wrapped into a fallback decoder to permit software fallback. | 427 // Decoder wrapped into a fallback decoder to permit software fallback. |
(...skipping 17 matching lines...) Expand all Loading... |
444 | 445 |
445 webrtc::VideoReceiveStream* stream_; | 446 webrtc::VideoReceiveStream* stream_; |
446 const bool default_stream_; | 447 const bool default_stream_; |
447 webrtc::VideoReceiveStream::Config config_; | 448 webrtc::VideoReceiveStream::Config config_; |
448 | 449 |
449 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 450 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
450 std::vector<AllocatedDecoder> allocated_decoders_; | 451 std::vector<AllocatedDecoder> allocated_decoders_; |
451 | 452 |
452 const bool disable_prerenderer_smoothing_; | 453 const bool disable_prerenderer_smoothing_; |
453 | 454 |
454 rtc::CriticalSection renderer_lock_; | 455 rtc::CriticalSection sink_lock_; |
455 cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_); | 456 rtc::VideoSinkInterface<cricket::VideoFrame>* sink_ GUARDED_BY(sink_lock_); |
456 int last_width_ GUARDED_BY(renderer_lock_); | 457 int last_width_ GUARDED_BY(sink_lock_); |
457 int last_height_ GUARDED_BY(renderer_lock_); | 458 int last_height_ GUARDED_BY(sink_lock_); |
458 // Expands remote RTP timestamps to int64_t to be able to estimate how long | 459 // Expands remote RTP timestamps to int64_t to be able to estimate how long |
459 // the stream has been running. | 460 // the stream has been running. |
460 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 461 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ |
461 GUARDED_BY(renderer_lock_); | 462 GUARDED_BY(sink_lock_); |
462 int64_t first_frame_timestamp_ GUARDED_BY(renderer_lock_); | 463 int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_); |
463 // Start NTP time is estimated as current remote NTP time (estimated from | 464 // Start NTP time is estimated as current remote NTP time (estimated from |
464 // RTCP) minus the elapsed time, as soon as remote NTP time is available. | 465 // RTCP) minus the elapsed time, as soon as remote NTP time is available. |
465 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(renderer_lock_); | 466 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); |
466 }; | 467 }; |
467 | 468 |
468 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); | 469 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); |
469 void SetDefaultOptions(); | 470 void SetDefaultOptions(); |
470 | 471 |
471 bool SendRtp(const uint8_t* data, | 472 bool SendRtp(const uint8_t* data, |
472 size_t len, | 473 size_t len, |
473 const webrtc::PacketOptions& options) override; | 474 const webrtc::PacketOptions& options) override; |
474 bool SendRtcp(const uint8_t* data, size_t len) override; | 475 bool SendRtcp(const uint8_t* data, size_t len) override; |
475 | 476 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 VideoOptions options_; | 527 VideoOptions options_; |
527 // TODO(deadbeef): Don't duplicate information between | 528 // TODO(deadbeef): Don't duplicate information between |
528 // send_params/recv_params, rtp_extensions, options, etc. | 529 // send_params/recv_params, rtp_extensions, options, etc. |
529 VideoSendParameters send_params_; | 530 VideoSendParameters send_params_; |
530 VideoRecvParameters recv_params_; | 531 VideoRecvParameters recv_params_; |
531 }; | 532 }; |
532 | 533 |
533 } // namespace cricket | 534 } // namespace cricket |
534 | 535 |
535 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 536 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
OLD | NEW |