| 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" | |
| 44 #include "webrtc/call.h" | 43 #include "webrtc/call.h" |
| 45 #include "webrtc/transport.h" | 44 #include "webrtc/transport.h" |
| 46 #include "webrtc/video_frame.h" | 45 #include "webrtc/video_frame.h" |
| 47 #include "webrtc/video_receive_stream.h" | 46 #include "webrtc/video_receive_stream.h" |
| 48 #include "webrtc/video_renderer.h" | 47 #include "webrtc/video_renderer.h" |
| 49 #include "webrtc/video_send_stream.h" | 48 #include "webrtc/video_send_stream.h" |
| 50 | 49 |
| 51 namespace webrtc { | 50 namespace webrtc { |
| 52 class VideoDecoder; | 51 class VideoDecoder; |
| 53 class VideoEncoder; | 52 class VideoEncoder; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // TODO(deadbeef): Move logic from SetRecvCodecs/SetRtpExtensions/etc. | 407 // TODO(deadbeef): Move logic from SetRecvCodecs/SetRtpExtensions/etc. |
| 409 // into this method. Currently this method only sets the RTCP mode. | 408 // into this method. Currently this method only sets the RTCP mode. |
| 410 void SetRecvParameters(const VideoRecvParameters& recv_params); | 409 void SetRecvParameters(const VideoRecvParameters& recv_params); |
| 411 | 410 |
| 412 void RenderFrame(const webrtc::VideoFrame& frame, | 411 void RenderFrame(const webrtc::VideoFrame& frame, |
| 413 int time_to_render_ms) override; | 412 int time_to_render_ms) override; |
| 414 bool IsTextureSupported() const override; | 413 bool IsTextureSupported() const override; |
| 415 bool SmoothsRenderedFrames() const override; | 414 bool SmoothsRenderedFrames() const override; |
| 416 bool IsDefaultStream() const; | 415 bool IsDefaultStream() const; |
| 417 | 416 |
| 418 void SetSink(rtc::VideoSinkInterface<cricket::VideoFrame>* sink); | 417 void SetRenderer(cricket::VideoRenderer* renderer); |
| 419 | 418 |
| 420 VideoReceiverInfo GetVideoReceiverInfo(); | 419 VideoReceiverInfo GetVideoReceiverInfo(); |
| 421 | 420 |
| 422 private: | 421 private: |
| 423 struct AllocatedDecoder { | 422 struct AllocatedDecoder { |
| 424 AllocatedDecoder(webrtc::VideoDecoder* decoder, | 423 AllocatedDecoder(webrtc::VideoDecoder* decoder, |
| 425 webrtc::VideoCodecType type, | 424 webrtc::VideoCodecType type, |
| 426 bool external); | 425 bool external); |
| 427 webrtc::VideoDecoder* decoder; | 426 webrtc::VideoDecoder* decoder; |
| 428 // 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... |
| 446 | 445 |
| 447 webrtc::VideoReceiveStream* stream_; | 446 webrtc::VideoReceiveStream* stream_; |
| 448 const bool default_stream_; | 447 const bool default_stream_; |
| 449 webrtc::VideoReceiveStream::Config config_; | 448 webrtc::VideoReceiveStream::Config config_; |
| 450 | 449 |
| 451 WebRtcVideoDecoderFactory* const external_decoder_factory_; | 450 WebRtcVideoDecoderFactory* const external_decoder_factory_; |
| 452 std::vector<AllocatedDecoder> allocated_decoders_; | 451 std::vector<AllocatedDecoder> allocated_decoders_; |
| 453 | 452 |
| 454 const bool disable_prerenderer_smoothing_; | 453 const bool disable_prerenderer_smoothing_; |
| 455 | 454 |
| 456 rtc::CriticalSection sink_lock_; | 455 rtc::CriticalSection renderer_lock_; |
| 457 rtc::VideoSinkInterface<cricket::VideoFrame>* sink_ GUARDED_BY(sink_lock_); | 456 cricket::VideoRenderer* renderer_ GUARDED_BY(renderer_lock_); |
| 458 int last_width_ GUARDED_BY(sink_lock_); | 457 int last_width_ GUARDED_BY(renderer_lock_); |
| 459 int last_height_ GUARDED_BY(sink_lock_); | 458 int last_height_ GUARDED_BY(renderer_lock_); |
| 460 // 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 |
| 461 // the stream has been running. | 460 // the stream has been running. |
| 462 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ | 461 rtc::TimestampWrapAroundHandler timestamp_wraparound_handler_ |
| 463 GUARDED_BY(sink_lock_); | 462 GUARDED_BY(renderer_lock_); |
| 464 int64_t first_frame_timestamp_ GUARDED_BY(sink_lock_); | 463 int64_t first_frame_timestamp_ GUARDED_BY(renderer_lock_); |
| 465 // 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 |
| 466 // 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. |
| 467 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(sink_lock_); | 466 int64_t estimated_remote_start_ntp_time_ms_ GUARDED_BY(renderer_lock_); |
| 468 }; | 467 }; |
| 469 | 468 |
| 470 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); | 469 void Construct(webrtc::Call* call, WebRtcVideoEngine2* engine); |
| 471 void SetDefaultOptions(); | 470 void SetDefaultOptions(); |
| 472 | 471 |
| 473 bool SendRtp(const uint8_t* data, | 472 bool SendRtp(const uint8_t* data, |
| 474 size_t len, | 473 size_t len, |
| 475 const webrtc::PacketOptions& options) override; | 474 const webrtc::PacketOptions& options) override; |
| 476 bool SendRtcp(const uint8_t* data, size_t len) override; | 475 bool SendRtcp(const uint8_t* data, size_t len) override; |
| 477 | 476 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 VideoOptions options_; | 527 VideoOptions options_; |
| 529 // TODO(deadbeef): Don't duplicate information between | 528 // TODO(deadbeef): Don't duplicate information between |
| 530 // send_params/recv_params, rtp_extensions, options, etc. | 529 // send_params/recv_params, rtp_extensions, options, etc. |
| 531 VideoSendParameters send_params_; | 530 VideoSendParameters send_params_; |
| 532 VideoRecvParameters recv_params_; | 531 VideoRecvParameters recv_params_; |
| 533 }; | 532 }; |
| 534 | 533 |
| 535 } // namespace cricket | 534 } // namespace cricket |
| 536 | 535 |
| 537 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ | 536 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_H_ |
| OLD | NEW |