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

Side by Side Diff: content/renderer/media/media_stream_impl.cc

Issue 23742005: Check the sample rate before passing the audio params to webrtc audio renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer/media/media_stream_impl.h" 5 #include "content/renderer/media/media_stream_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 693
694 // TODO(tommi): Storing the session id in the deviceId field doesn't 694 // TODO(tommi): Storing the session id in the deviceId field doesn't
695 // feel right. Move it over to MediaStreamSourceExtraData? 695 // feel right. Move it over to MediaStreamSourceExtraData?
696 session_id_str = source.deviceId(); 696 session_id_str = source.deviceId();
697 content::MediaStreamSourceExtraData* extra_data = 697 content::MediaStreamSourceExtraData* extra_data =
698 static_cast<content::MediaStreamSourceExtraData*>(source.extraData()); 698 static_cast<content::MediaStreamSourceExtraData*>(source.extraData());
699 device_info = &extra_data->device_info(); 699 device_info = &extra_data->device_info();
700 } 700 }
701 } 701 }
702 702
703 if (session_id_str.isEmpty() || !device_info) 703 if (session_id_str.isEmpty() || !device_info ||
704 !device_info->device.matched_output.sample_rate) {
704 return false; 705 return false;
706 }
705 707
706 base::StringToInt(UTF16ToUTF8(session_id_str), session_id); 708 base::StringToInt(UTF16ToUTF8(session_id_str), session_id);
707 *output_sample_rate = device_info->device.matched_output.sample_rate; 709 *output_sample_rate = device_info->device.matched_output.sample_rate;
708 *output_frames_per_buffer = 710 *output_frames_per_buffer =
709 device_info->device.matched_output.frames_per_buffer; 711 device_info->device.matched_output.frames_per_buffer;
710 712
711 return true; 713 return true;
712 } 714 }
713 715
714 MediaStreamSourceExtraData::MediaStreamSourceExtraData( 716 MediaStreamSourceExtraData::MediaStreamSourceExtraData(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 771 }
770 772
771 for (size_t i = 0; i < video_sources.size(); ++i) { 773 for (size_t i = 0; i < video_sources.size(); ++i) {
772 video_sources[i].setReadyState( 774 video_sources[i].setReadyState(
773 WebKit::WebMediaStreamSource::ReadyStateEnded); 775 WebKit::WebMediaStreamSource::ReadyStateEnded);
774 video_sources[i].setExtraData(NULL); 776 video_sources[i].setExtraData(NULL);
775 } 777 }
776 } 778 }
777 779
778 } // namespace content 780 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698