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