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

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

Issue 1083883003: Move BindToCurrentLoop from media/base/ to base/ Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix media/base/callback_holder.h compile Created 5 years, 8 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
« no previous file with comments | « chrome/renderer/media/cast_receiver_session.cc ('k') | chrome/renderer/media/cast_session.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_rtp_stream.h" 5 #include "chrome/renderer/media/cast_rtp_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_to_current_loop.h"
8 #include "base/command_line.h" 9 #include "base/command_line.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
12 #include "base/sys_info.h" 13 #include "base/sys_info.h"
13 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/renderer/media/cast_session.h" 16 #include "chrome/renderer/media/cast_session.h"
16 #include "chrome/renderer/media/cast_udp_transport.h" 17 #include "chrome/renderer/media/cast_udp_transport.h"
17 #include "content/public/renderer/media_stream_audio_sink.h" 18 #include "content/public/renderer/media_stream_audio_sink.h"
18 #include "content/public/renderer/media_stream_video_sink.h" 19 #include "content/public/renderer/media_stream_video_sink.h"
19 #include "content/public/renderer/render_thread.h" 20 #include "content/public/renderer/render_thread.h"
20 #include "content/public/renderer/video_encode_accelerator.h" 21 #include "content/public/renderer/video_encode_accelerator.h"
21 #include "media/audio/audio_parameters.h" 22 #include "media/audio/audio_parameters.h"
22 #include "media/base/audio_bus.h" 23 #include "media/base/audio_bus.h"
23 #include "media/base/audio_converter.h" 24 #include "media/base/audio_converter.h"
24 #include "media/base/audio_fifo.h" 25 #include "media/base/audio_fifo.h"
25 #include "media/base/bind_to_current_loop.h"
26 #include "media/base/video_frame.h" 26 #include "media/base/video_frame.h"
27 #include "media/cast/cast_config.h" 27 #include "media/cast/cast_config.h"
28 #include "media/cast/cast_defines.h" 28 #include "media/cast/cast_defines.h"
29 #include "media/cast/cast_sender.h" 29 #include "media/cast/cast_sender.h"
30 #include "media/cast/net/cast_transport_config.h" 30 #include "media/cast/net/cast_transport_config.h"
31 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 31 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
32 #include "ui/gfx/geometry/size.h" 32 #include "ui/gfx/geometry/size.h"
33 33
34 using media::cast::AudioSenderConfig; 34 using media::cast::AudioSenderConfig;
35 using media::cast::VideoSenderConfig; 35 using media::cast::VideoSenderConfig;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 start_callback.Run(); 518 start_callback.Run();
519 } else { 519 } else {
520 VideoSenderConfig config; 520 VideoSenderConfig config;
521 if (!ToVideoSenderConfig(params, &config)) { 521 if (!ToVideoSenderConfig(params, &config)) {
522 DidEncounterError("Invalid parameters for video."); 522 DidEncounterError("Invalid parameters for video.");
523 return; 523 return;
524 } 524 }
525 // See the code for audio above for explanation of callbacks. 525 // See the code for audio above for explanation of callbacks.
526 video_sink_.reset(new CastVideoSink( 526 video_sink_.reset(new CastVideoSink(
527 track_, 527 track_,
528 media::BindToCurrentLoop(base::Bind(&CastRtpStream::DidEncounterError, 528 base::BindToCurrentLoop(base::Bind(&CastRtpStream::DidEncounterError,
529 weak_factory_.GetWeakPtr())))); 529 weak_factory_.GetWeakPtr()))));
530 cast_session_->StartVideo( 530 cast_session_->StartVideo(
531 config, 531 config,
532 base::Bind(&CastVideoSink::AddToTrack, video_sink_->AsWeakPtr()), 532 base::Bind(&CastVideoSink::AddToTrack, video_sink_->AsWeakPtr()),
533 base::Bind(&CastRtpStream::DidEncounterError, 533 base::Bind(&CastRtpStream::DidEncounterError,
534 weak_factory_.GetWeakPtr())); 534 weak_factory_.GetWeakPtr()));
535 start_callback.Run(); 535 start_callback.Run();
536 } 536 }
537 } 537 }
538 538
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 void CastRtpStream::DidEncounterError(const std::string& message) { 572 void CastRtpStream::DidEncounterError(const std::string& message) {
573 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = " 573 DVLOG(1) << "CastRtpStream::DidEncounterError(" << message << ") = "
574 << (IsAudio() ? "audio" : "video"); 574 << (IsAudio() ? "audio" : "video");
575 // Save the WeakPtr first because the error callback might delete this object. 575 // Save the WeakPtr first because the error callback might delete this object.
576 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr(); 576 base::WeakPtr<CastRtpStream> ptr = weak_factory_.GetWeakPtr();
577 error_callback_.Run(message); 577 error_callback_.Run(message);
578 content::RenderThread::Get()->GetTaskRunner()->PostTask( 578 content::RenderThread::Get()->GetTaskRunner()->PostTask(
579 FROM_HERE, 579 FROM_HERE,
580 base::Bind(&CastRtpStream::Stop, ptr)); 580 base::Bind(&CastRtpStream::Stop, ptr));
581 } 581 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/cast_receiver_session.cc ('k') | chrome/renderer/media/cast_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698