Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: media/cast/video_sender/video_sender.cc

Issue 207593002: Cast: Enable use of VideoEncodeAccelerator for hardware video encoding (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typedef Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "media/cast/video_sender/video_sender.h" 5 #include "media/cast/video_sender/video_sender.h"
6 6
7 #include <cstring> 7 #include <cstring>
8 #include <list> 8 #include <list>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 29 matching lines...) Expand all
40 40
41 private: 41 private:
42 VideoSender* video_sender_; 42 VideoSender* video_sender_;
43 43
44 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalRtcpVideoSenderFeedback); 44 DISALLOW_IMPLICIT_CONSTRUCTORS(LocalRtcpVideoSenderFeedback);
45 }; 45 };
46 46
47 VideoSender::VideoSender( 47 VideoSender::VideoSender(
48 scoped_refptr<CastEnvironment> cast_environment, 48 scoped_refptr<CastEnvironment> cast_environment,
49 const VideoSenderConfig& video_config, 49 const VideoSenderConfig& video_config,
50 const scoped_refptr<GpuVideoAcceleratorFactories>& gpu_factories, 50 const CreateVideoEncodeAcceleratorCallback& create_vea_cb,
51 const CreateVideoEncodeMemoryCallback& create_video_encode_mem_cb,
51 const CastInitializationCallback& cast_initialization_cb, 52 const CastInitializationCallback& cast_initialization_cb,
52 transport::CastTransportSender* const transport_sender) 53 transport::CastTransportSender* const transport_sender)
53 : rtp_max_delay_(base::TimeDelta::FromMilliseconds( 54 : rtp_max_delay_(base::TimeDelta::FromMilliseconds(
54 video_config.rtp_config.max_delay_ms)), 55 video_config.rtp_config.max_delay_ms)),
55 max_frame_rate_(video_config.max_frame_rate), 56 max_frame_rate_(video_config.max_frame_rate),
56 cast_environment_(cast_environment), 57 cast_environment_(cast_environment),
57 transport_sender_(transport_sender), 58 transport_sender_(transport_sender),
58 event_subscriber_(kMaxEventSubscriberEntries), 59 event_subscriber_(kMaxEventSubscriberEntries),
59 rtp_stats_(kVideoFrequency), 60 rtp_stats_(kVideoFrequency),
60 rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)), 61 rtcp_feedback_(new LocalRtcpVideoSenderFeedback(this)),
61 last_acked_frame_id_(-1), 62 last_acked_frame_id_(-1),
62 last_sent_frame_id_(-1), 63 last_sent_frame_id_(-1),
63 duplicate_ack_(0), 64 duplicate_ack_(0),
64 last_skip_count_(0), 65 last_skip_count_(0),
65 congestion_control_(cast_environment->Clock(), 66 congestion_control_(cast_environment->Clock(),
66 video_config.congestion_control_back_off, 67 video_config.congestion_control_back_off,
67 video_config.max_bitrate, 68 video_config.max_bitrate,
68 video_config.min_bitrate, 69 video_config.min_bitrate,
69 video_config.start_bitrate), 70 video_config.start_bitrate),
70 initialized_(false), 71 initialized_(false),
71 active_session_(false), 72 active_session_(false),
72 weak_factory_(this) { 73 weak_factory_(this) {
73 max_unacked_frames_ = 74 max_unacked_frames_ =
74 1 + static_cast<uint8>(video_config.rtp_config.max_delay_ms * 75 1 + static_cast<uint8>(video_config.rtp_config.max_delay_ms *
75 max_frame_rate_ / 1000); 76 max_frame_rate_ / 1000);
76 VLOG(1) << "max_unacked_frames " << static_cast<int>(max_unacked_frames_); 77 VLOG(1) << "max_unacked_frames " << static_cast<int>(max_unacked_frames_);
77 DCHECK_GT(max_unacked_frames_, 0) << "Invalid argument"; 78 DCHECK_GT(max_unacked_frames_, 0) << "Invalid argument";
78 79
79 if (video_config.use_external_encoder) { 80 if (video_config.use_external_encoder) {
80 CHECK(gpu_factories); 81 video_encoder_.reset(new ExternalVideoEncoder(cast_environment,
81 video_encoder_.reset(new ExternalVideoEncoder( 82 video_config,
82 cast_environment, video_config, gpu_factories)); 83 create_vea_cb,
84 create_video_encode_mem_cb));
83 } else { 85 } else {
84 video_encoder_.reset(new VideoEncoderImpl( 86 video_encoder_.reset(new VideoEncoderImpl(
85 cast_environment, video_config, max_unacked_frames_)); 87 cast_environment, video_config, max_unacked_frames_));
86 } 88 }
87 89
88 rtcp_.reset( 90 rtcp_.reset(
89 new Rtcp(cast_environment_, 91 new Rtcp(cast_environment_,
90 rtcp_feedback_.get(), 92 rtcp_feedback_.get(),
91 transport_sender_, 93 transport_sender_,
92 NULL, // paced sender. 94 NULL, // paced sender.
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 481
480 void VideoSender::ResendPacketsOnTransportThread( 482 void VideoSender::ResendPacketsOnTransportThread(
481 const transport::MissingFramesAndPacketsMap& missing_packets) { 483 const transport::MissingFramesAndPacketsMap& missing_packets) {
482 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::TRANSPORT)); 484 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::TRANSPORT));
483 last_send_time_ = cast_environment_->Clock()->NowTicks(); 485 last_send_time_ = cast_environment_->Clock()->NowTicks();
484 transport_sender_->ResendPackets(false, missing_packets); 486 transport_sender_->ResendPackets(false, missing_packets);
485 } 487 }
486 488
487 } // namespace cast 489 } // namespace cast
488 } // namespace media 490 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/video_sender/video_sender.h ('k') | media/cast/video_sender/video_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698