]>
Commit | Line | Data |
---|---|---|
c1edaafa ER |
1 | https://chromiumcodereview.appspot.com/10332119 |
2 | https://src.chromium.org/viewvc/chrome?view=rev&revision=136602 | |
3 | https://code.google.com/p/chromium/issues/detail?id=111392 | |
4 | https://code.google.com/p/chromium/issues/detail?id=119903 | |
5 | ||
6 | Index: media/audio/pulse/pulse_output.cc | |
f4a8da6a | 7 | diff --git a/media/audio/pulse/pulse_output.cc b/media/audio/pulse/pulse_output.cc |
c1edaafa | 8 | index df4b5be979c6937b949f0c9dc8822236b92c6c6a..98f1f58391cd3faf615da999affe4d29a56876c8 100644 |
f4a8da6a ER |
9 | --- a/media/audio/pulse/pulse_output.cc |
10 | +++ b/media/audio/pulse/pulse_output.cc | |
c1edaafa | 11 | @@ -128,7 +128,7 @@ void PulseAudioOutputStream::WriteRequestCallback(pa_stream* playback_handle, |
f4a8da6a ER |
12 | PulseAudioOutputStream* stream = |
13 | reinterpret_cast<PulseAudioOutputStream*>(stream_addr); | |
14 | ||
15 | - DCHECK_EQ(stream->manager_->GetMessageLoop(), MessageLoop::current()); | |
16 | + DCHECK(stream->manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
17 | ||
18 | stream->write_callback_handled_ = true; | |
19 | ||
c1edaafa ER |
20 | @@ -138,16 +138,16 @@ void PulseAudioOutputStream::WriteRequestCallback(pa_stream* playback_handle, |
21 | ||
22 | PulseAudioOutputStream::PulseAudioOutputStream(const AudioParameters& params, | |
23 | AudioManagerPulse* manager) | |
24 | - : channel_layout_(params.channel_layout), | |
25 | + : channel_layout_(params.channel_layout()), | |
26 | channel_count_(ChannelLayoutToChannelCount(channel_layout_)), | |
27 | - sample_format_(BitsToPASampleFormat(params.bits_per_sample)), | |
28 | - sample_rate_(params.sample_rate), | |
29 | - bytes_per_frame_(params.channels * params.bits_per_sample / 8), | |
30 | + sample_format_(BitsToPASampleFormat(params.bits_per_sample())), | |
31 | + sample_rate_(params.sample_rate()), | |
32 | + bytes_per_frame_(params.GetBytesPerFrame()), | |
33 | manager_(manager), | |
34 | pa_context_(NULL), | |
35 | pa_mainloop_(NULL), | |
36 | playback_handle_(NULL), | |
37 | - packet_size_(params.GetPacketSize()), | |
38 | + packet_size_(params.GetBytesPerBuffer()), | |
39 | frames_per_packet_(packet_size_ / bytes_per_frame_), | |
40 | client_buffer_(NULL), | |
41 | volume_(1.0f), | |
42 | @@ -155,7 +155,7 @@ PulseAudioOutputStream::PulseAudioOutputStream(const AudioParameters& params, | |
f4a8da6a ER |
43 | write_callback_handled_(false), |
44 | ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | |
45 | source_callback_(NULL) { | |
46 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
47 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
48 | ||
49 | // TODO(slock): Sanity check input values. | |
50 | } | |
c1edaafa | 51 | @@ -169,7 +169,7 @@ PulseAudioOutputStream::~PulseAudioOutputStream() { |
f4a8da6a ER |
52 | } |
53 | ||
54 | bool PulseAudioOutputStream::Open() { | |
55 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
56 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
57 | ||
58 | // TODO(slock): Possibly move most of this to an OpenPlaybackDevice function | |
59 | // in a new class 'pulse_util', like alsa_util. | |
c1edaafa | 60 | @@ -272,7 +272,7 @@ void PulseAudioOutputStream::Reset() { |
f4a8da6a ER |
61 | } |
62 | ||
63 | void PulseAudioOutputStream::Close() { | |
64 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
65 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
66 | ||
67 | Reset(); | |
68 | ||
c1edaafa | 69 | @@ -282,7 +282,7 @@ void PulseAudioOutputStream::Close() { |
f4a8da6a ER |
70 | } |
71 | ||
72 | void PulseAudioOutputStream::WaitForWriteRequest() { | |
73 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
74 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
75 | ||
76 | if (stream_stopped_) | |
77 | return; | |
c1edaafa ER |
78 | @@ -337,8 +337,8 @@ void PulseAudioOutputStream::FulfillWriteRequest(size_t requested_bytes) { |
79 | // Request more data from the source until we can fulfill the request or | |
80 | // fail to receive anymore data. | |
81 | bool buffering_successful = true; | |
82 | - while (client_buffer_->forward_bytes() < requested_bytes && | |
83 | - buffering_successful) { | |
84 | + size_t forward_bytes = static_cast<size_t>(client_buffer_->forward_bytes()); | |
85 | + while (forward_bytes < requested_bytes && buffering_successful) { | |
86 | buffering_successful = BufferPacketFromSource(); | |
87 | } | |
88 | ||
89 | @@ -369,7 +369,7 @@ void PulseAudioOutputStream::WriteToStream(size_t bytes_to_write, | |
90 | *bytes_written = 0; | |
91 | while (*bytes_written < bytes_to_write) { | |
92 | const uint8* chunk; | |
93 | - size_t chunk_size; | |
94 | + int chunk_size; | |
95 | ||
96 | // Stop writing if there is no more data available. | |
97 | if (!client_buffer_->GetCurrentChunk(&chunk, &chunk_size)) | |
98 | @@ -384,7 +384,7 @@ void PulseAudioOutputStream::WriteToStream(size_t bytes_to_write, | |
f4a8da6a ER |
99 | } |
100 | ||
101 | void PulseAudioOutputStream::Start(AudioSourceCallback* callback) { | |
102 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
103 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
104 | CHECK(callback); | |
105 | DLOG_IF(ERROR, !playback_handle_) | |
106 | << "Open() has not been called successfully"; | |
c1edaafa | 107 | @@ -404,19 +404,19 @@ void PulseAudioOutputStream::Start(AudioSourceCallback* callback) { |
f4a8da6a ER |
108 | } |
109 | ||
110 | void PulseAudioOutputStream::Stop() { | |
111 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
112 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
113 | ||
114 | stream_stopped_ = true; | |
115 | } | |
116 | ||
117 | void PulseAudioOutputStream::SetVolume(double volume) { | |
118 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
119 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
120 | ||
121 | volume_ = static_cast<float>(volume); | |
122 | } | |
123 | ||
124 | void PulseAudioOutputStream::GetVolume(double* volume) { | |
125 | - DCHECK_EQ(manager_->GetMessageLoop(), MessageLoop::current()); | |
126 | + DCHECK(manager_->GetMessageLoop()->BelongsToCurrentThread()); | |
127 | ||
128 | *volume = volume_; | |
129 | } |