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

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

Issue 170843004: Pass Client pointer in Initialize() for VDA/VEA (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 50e826de Rebase. Created 6 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/external_video_encoder.h" 5 #include "media/cast/video_sender/external_video_encoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 // Initialize the real HW encoder. 67 // Initialize the real HW encoder.
68 void Initialize(const VideoSenderConfig& video_config) { 68 void Initialize(const VideoSenderConfig& video_config) {
69 DCHECK(gpu_factories_); 69 DCHECK(gpu_factories_);
70 DCHECK(encoder_task_runner_); 70 DCHECK(encoder_task_runner_);
71 71
72 DCHECK(encoder_task_runner_->RunsTasksOnCurrentThread()); 72 DCHECK(encoder_task_runner_->RunsTasksOnCurrentThread());
73 73
74 video_encode_accelerator_ = 74 video_encode_accelerator_ =
75 gpu_factories_->CreateVideoEncodeAccelerator(this).Pass(); 75 gpu_factories_->CreateVideoEncodeAccelerator().Pass();
76 if (!video_encode_accelerator_) 76 if (!video_encode_accelerator_)
77 return; 77 return;
78 78
79 VideoCodecProfile output_profile = media::VIDEO_CODEC_PROFILE_UNKNOWN; 79 VideoCodecProfile output_profile = media::VIDEO_CODEC_PROFILE_UNKNOWN;
80 switch (video_config.codec) { 80 switch (video_config.codec) {
81 case transport::kVp8: 81 case transport::kVp8:
82 output_profile = media::VP8PROFILE_MAIN; 82 output_profile = media::VP8PROFILE_MAIN;
83 break; 83 break;
84 case transport::kH264: 84 case transport::kH264:
85 output_profile = media::H264PROFILE_MAIN; 85 output_profile = media::H264PROFILE_MAIN;
86 break; 86 break;
87 } 87 }
88 codec_ = video_config.codec; 88 codec_ = video_config.codec;
89 max_frame_rate_ = video_config.max_frame_rate; 89 max_frame_rate_ = video_config.max_frame_rate;
90 90
91 // Asynchronous initialization call; NotifyInitializeDone or NotifyError 91 // Asynchronous initialization call; NotifyInitializeDone or NotifyError
92 // will be called once the HW is initialized. 92 // will be called once the HW is initialized.
93 video_encode_accelerator_->Initialize( 93 video_encode_accelerator_->Initialize(
94 media::VideoFrame::I420, 94 media::VideoFrame::I420,
95 gfx::Size(video_config.width, video_config.height), 95 gfx::Size(video_config.width, video_config.height),
96 output_profile, 96 output_profile,
97 video_config.start_bitrate); 97 video_config.start_bitrate,
98 this);
98 } 99 }
99 100
100 // Free the HW. 101 // Free the HW.
101 void Destroy() { 102 void Destroy() {
102 DCHECK(encoder_task_runner_); 103 DCHECK(encoder_task_runner_);
103 DCHECK(encoder_task_runner_->RunsTasksOnCurrentThread()); 104 DCHECK(encoder_task_runner_->RunsTasksOnCurrentThread());
104 105
105 if (video_encode_accelerator_) { 106 if (video_encode_accelerator_) {
106 video_encode_accelerator_.release()->Destroy(); 107 video_encode_accelerator_.release()->Destroy();
107 } 108 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // Do nothing not supported. 449 // Do nothing not supported.
449 } 450 }
450 451
451 int ExternalVideoEncoder::NumberOfSkippedFrames() const { 452 int ExternalVideoEncoder::NumberOfSkippedFrames() const {
452 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN)); 453 DCHECK(cast_environment_->CurrentlyOn(CastEnvironment::MAIN));
453 return skip_count_; 454 return skip_count_;
454 } 455 }
455 456
456 } // namespace cast 457 } // namespace cast
457 } // namespace media 458 } // namespace media
OLDNEW
« no previous file with comments | « media/cast/test/fake_video_encode_accelerator.cc ('k') | media/filters/gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698