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

Side by Side Diff: content/public/renderer/media_stream_audio_sink.cc

Issue 857093002: Set audio format before adding pepper sink to audio track. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 5 years, 11 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 "content/public/renderer/media_stream_audio_sink.h" 5 #include "content/public/renderer/media_stream_audio_sink.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/renderer/media/media_stream_track.h" 8 #include "content/renderer/media/media_stream_track.h"
9 #include "content/renderer/media/webrtc_local_audio_track.h" 9 #include "content/renderer/media/webrtc_local_audio_track.h"
10 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 10 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
(...skipping 25 matching lines...) Expand all
36 if (!native_track->is_local_track()) { 36 if (!native_track->is_local_track()) {
37 LOG(ERROR) << "Can't remove the sink from a remote audio track"; 37 LOG(ERROR) << "Can't remove the sink from a remote audio track";
38 return; 38 return;
39 } 39 }
40 40
41 WebRtcLocalAudioTrack* audio_track = 41 WebRtcLocalAudioTrack* audio_track =
42 static_cast<WebRtcLocalAudioTrack*>(native_track); 42 static_cast<WebRtcLocalAudioTrack*>(native_track);
43 audio_track->RemoveSink(sink); 43 audio_track->RemoveSink(sink);
44 } 44 }
45 45
46 const media::AudioParameters& MediaStreamAudioSink::GetFormatFromAudioTrack(
47 const blink::WebMediaStreamTrack& track) {
48 // Invalid AudioParameters to return when track is remote. Needed because we
49 // return a reference.
dmichael (off chromium) 2015/01/20 17:07:03 I think it would be a lot better to just return by
Anand Mistry (off Chromium) 2015/01/27 02:12:10 Done.
50 static const media::AudioParameters null_format;
DaleCurtis 2015/01/20 18:46:56 This seems unnecessary, just return media::AudioPa
Anand Mistry (off Chromium) 2015/01/27 02:12:10 Because it needs to survive after the function cal
51 MediaStreamTrack* native_track = MediaStreamTrack::GetTrack(track);
52 if (!native_track->is_local_track()) {
53 LOG(ERROR) << "Can't get format from a remote audio track";
54 return null_format;
55 }
56
57 WebRtcLocalAudioTrack* audio_track =
58 static_cast<WebRtcLocalAudioTrack*>(native_track);
59 return audio_track->GetOutputFormat();
60 }
61
46 } // namespace content 62 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698