| 229 | // values. |
| 230 | |
| 231 | class DecodingDelayDetector : public AudioProcessor |
| 232 | { |
| 233 | public: |
| 234 | DecodingDelayDetector() : |
| 235 | channels_(0), |
| 236 | frame_count_(0), |
| 237 | start_frame_(-1) |
| 238 | { |
| 239 | } |
| 240 | |
| 241 | public: |
| 242 | virtual bool init( |
| 243 | int /* sample_rate */, |
| 244 | int channels, |
| 245 | long /* frame_count */, |
| 246 | int /* buffer_size */) |
| 247 | { |
| 248 | channels_ = channels; |
| 249 | return true; |
| 250 | } |
| 251 | |
| 252 | virtual bool shouldContinue() const |
| 253 | { |
| 254 | return true; |
| 255 | } |
| 256 | |
| 257 | virtual bool process( |
| 258 | const short* input_buffer, |
| 259 | int input_frame_count) |
| 260 | { |
| 261 | if (start_frame_ != -1) { |
| 262 | return true; |
| 263 | } |
| 264 | |
| 265 | for (int i = 0; i < input_frame_count * channels_; ++i) { |
| 266 | if (input_buffer[i] != 0) { |
| 267 | start_frame_ = frame_count_ + i; |
| 268 | break; |
| 269 | } |
| 270 | } |
| 271 | |
| 272 | frame_count_ += input_frame_count; |
| 273 | |
| 274 | return true; |
| 275 | } |
| 276 | |
| 277 | virtual void done() |
| 278 | { |
| 279 | } |
| 280 | |
| 281 | public: |
| 282 | int getStartFrame() const |
| 283 | { |
| 284 | return start_frame_; |
| 285 | } |
| 286 | |
| 287 | private: |
| 288 | int channels_; |
nothing calls this directly
no outgoing calls
no test coverage detected