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

Side by Side Diff: chrome/renderer/media/cast_session_delegate.cc

Issue 2113783002: Refactoring: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mek's comment. Created 4 years, 5 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
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 "chrome/renderer/media/cast_session_delegate.h" 5 #include "chrome/renderer/media/cast_session_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 11 matching lines...) Expand all
22 #include "media/cast/cast_config.h" 22 #include "media/cast/cast_config.h"
23 #include "media/cast/cast_environment.h" 23 #include "media/cast/cast_environment.h"
24 #include "media/cast/cast_sender.h" 24 #include "media/cast/cast_sender.h"
25 #include "media/cast/logging/log_serializer.h" 25 #include "media/cast/logging/log_serializer.h"
26 #include "media/cast/logging/logging_defines.h" 26 #include "media/cast/logging/logging_defines.h"
27 #include "media/cast/logging/proto/raw_events.pb.h" 27 #include "media/cast/logging/proto/raw_events.pb.h"
28 #include "media/cast/logging/raw_event_subscriber_bundle.h" 28 #include "media/cast/logging/raw_event_subscriber_bundle.h"
29 #include "media/cast/net/cast_transport.h" 29 #include "media/cast/net/cast_transport.h"
30 #include "media/cast/net/cast_transport_config.h" 30 #include "media/cast/net/cast_transport_config.h"
31 31
32 using media::cast::AudioSenderConfig;
33 using media::cast::CastEnvironment; 32 using media::cast::CastEnvironment;
34 using media::cast::CastSender; 33 using media::cast::CastSender;
35 using media::cast::VideoSenderConfig; 34 using media::cast::FrameSenderConfig;
36 35
37 static base::LazyInstance<CastThreads> g_cast_threads = 36 static base::LazyInstance<CastThreads> g_cast_threads =
38 LAZY_INSTANCE_INITIALIZER; 37 LAZY_INSTANCE_INITIALIZER;
39 38
40 CastSessionDelegateBase::CastSessionDelegateBase() 39 CastSessionDelegateBase::CastSessionDelegateBase()
41 : io_task_runner_( 40 : io_task_runner_(
42 content::RenderThread::Get()->GetIOMessageLoopProxy()), 41 content::RenderThread::Get()->GetIOMessageLoopProxy()),
43 weak_factory_(this) { 42 weak_factory_(this) {
44 DCHECK(io_task_runner_.get()); 43 DCHECK(io_task_runner_.get());
45 #if defined(OS_WIN) 44 #if defined(OS_WIN)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 CastSessionDelegate::CastSessionDelegate() 109 CastSessionDelegate::CastSessionDelegate()
111 : weak_factory_(this) { 110 : weak_factory_(this) {
112 DCHECK(io_task_runner_.get()); 111 DCHECK(io_task_runner_.get());
113 } 112 }
114 113
115 CastSessionDelegate::~CastSessionDelegate() { 114 CastSessionDelegate::~CastSessionDelegate() {
116 DCHECK(io_task_runner_->BelongsToCurrentThread()); 115 DCHECK(io_task_runner_->BelongsToCurrentThread());
117 } 116 }
118 117
119 void CastSessionDelegate::StartAudio( 118 void CastSessionDelegate::StartAudio(
120 const AudioSenderConfig& config, 119 const FrameSenderConfig& config,
121 const AudioFrameInputAvailableCallback& callback, 120 const AudioFrameInputAvailableCallback& callback,
122 const ErrorCallback& error_callback) { 121 const ErrorCallback& error_callback) {
123 DCHECK(io_task_runner_->BelongsToCurrentThread()); 122 DCHECK(io_task_runner_->BelongsToCurrentThread());
124 123
125 if (!cast_transport_ || !cast_sender_) { 124 if (!cast_transport_ || !cast_sender_) {
126 error_callback.Run("Destination not set."); 125 error_callback.Run("Destination not set.");
127 return; 126 return;
128 } 127 }
129 128
130 audio_frame_input_available_callback_ = callback; 129 audio_frame_input_available_callback_ = callback;
131 cast_sender_->InitializeAudio( 130 cast_sender_->InitializeAudio(
132 config, 131 config,
133 base::Bind(&CastSessionDelegate::OnOperationalStatusChange, 132 base::Bind(&CastSessionDelegate::OnOperationalStatusChange,
134 weak_factory_.GetWeakPtr(), true, error_callback)); 133 weak_factory_.GetWeakPtr(), true, error_callback));
135 } 134 }
136 135
137 void CastSessionDelegate::StartVideo( 136 void CastSessionDelegate::StartVideo(
138 const VideoSenderConfig& config, 137 const FrameSenderConfig& config,
139 const VideoFrameInputAvailableCallback& callback, 138 const VideoFrameInputAvailableCallback& callback,
140 const ErrorCallback& error_callback, 139 const ErrorCallback& error_callback,
141 const media::cast::CreateVideoEncodeAcceleratorCallback& create_vea_cb, 140 const media::cast::CreateVideoEncodeAcceleratorCallback& create_vea_cb,
142 const media::cast::CreateVideoEncodeMemoryCallback& 141 const media::cast::CreateVideoEncodeMemoryCallback&
143 create_video_encode_mem_cb) { 142 create_video_encode_mem_cb) {
144 DCHECK(io_task_runner_->BelongsToCurrentThread()); 143 DCHECK(io_task_runner_->BelongsToCurrentThread());
145 144
146 if (!cast_transport_ || !cast_sender_) { 145 if (!cast_transport_ || !cast_sender_) {
147 error_callback.Run("Destination not set."); 146 error_callback.Run("Destination not set.");
148 return; 147 return;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 error_callback.Run(base::StringPrintf("%s codec runtime error.", 306 error_callback.Run(base::StringPrintf("%s codec runtime error.",
308 is_for_audio ? "Audio" : "Video")); 307 is_for_audio ? "Audio" : "Video"));
309 break; 308 break;
310 } 309 }
311 } 310 }
312 311
313 void CastSessionDelegate::ReceivePacket( 312 void CastSessionDelegate::ReceivePacket(
314 std::unique_ptr<media::cast::Packet> packet) { 313 std::unique_ptr<media::cast::Packet> packet) {
315 // Do nothing (frees packet) 314 // Do nothing (frees packet)
316 } 315 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_session_delegate.h ('k') | chrome/test/data/extensions/api_test/cast_streaming/rtp_stream_error.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698