Simplify audio sample delivery interface.

Switch to simple bool return codes. True is success. Remove status
enum.

Change-Id: I1e1b7b72924319cb9225efdd76f3696061d2f2b1
diff --git a/encoder/audio_encoder.h b/encoder/audio_encoder.h
index a9ad4b2..171dc26 100644
--- a/encoder/audio_encoder.h
+++ b/encoder/audio_encoder.h
@@ -96,20 +96,13 @@
 // implementor class to receive |AudioBuffer| pointers.
 class AudioSamplesCallbackInterface {
  public:
-  enum {
-    // |OnSamplesReceived()| failed because a buffer could not be allocated.
-    kNoMemory = -3,
-    // Returned by |OnSamplesReceived| when |ptr_sample_buffer| is NULL or
-    // empty.
-    kInvalidArg = -2,
-    kSuccess = 0,
-  };
   virtual ~AudioSamplesCallbackInterface() {}
 
   // Passes an |AudioBuffer| pointer to the |AudioSamplesCallbackInterface|
   // implementation, allowing it to take ownership of the contents. Argument
   // is non-const to allow for use of |AudioBuffer::Swap| by the implementor.
-  virtual int OnSamplesReceived(AudioBuffer* ptr_sample_buffer) = 0;
+  // Return true to signal success. Returning false terminates sample delivery.
+  virtual bool OnSamplesReceived(AudioBuffer* ptr_sample_buffer) = 0;
 };
 
 struct VorbisConfig {
diff --git a/encoder/webm_encoder.cc b/encoder/webm_encoder.cc
index c079cb0..be434d9 100644
--- a/encoder/webm_encoder.cc
+++ b/encoder/webm_encoder.cc
@@ -269,14 +269,14 @@
 }
 
 // AudioSamplesCallbackInterface
-int WebmEncoder::OnSamplesReceived(AudioBuffer* ptr_buffer) {
+bool WebmEncoder::OnSamplesReceived(AudioBuffer* ptr_buffer) {
   const int status = audio_pool_.Commit(ptr_buffer);
   if (status) {
     LOG(ERROR) << "AudioBuffer pool Commit failed! " << status;
-    return AudioSamplesCallbackInterface::kNoMemory;
+    return false;
   }
   LOG(INFO) << "OnSamplesReceived committed an audio buffer.";
-  return kSuccess;
+  return true;
 }
 
 // VideoFrameCallbackInterface
diff --git a/encoder/webm_encoder.h b/encoder/webm_encoder.h
index 6fd4751..87379c3 100644
--- a/encoder/webm_encoder.h
+++ b/encoder/webm_encoder.h
@@ -169,7 +169,7 @@
   };
 
   WebmEncoder();
-  ~WebmEncoder();
+  ~WebmEncoder() override;
 
   // Initializes the encoder. Returns |kSuccess| upon success, or one of the
   // above status codes upon failure. Always returns |kInvalidArg| when
@@ -191,14 +191,14 @@
   WebmEncoderConfig config() const { return config_; }
 
   // |AudioSamplesCallbackInterface| methods
-  // Method used by |MediaSourceImpl| to push audio buffers into
-  // |EncoderThread()|.
-  virtual int OnSamplesReceived(AudioBuffer* ptr_buffer);
+  // Method used by |MediaSourceImpl| to push audio buffers into encoding
+  // threads.
+  bool OnSamplesReceived(AudioBuffer* ptr_buffer) override;
 
   // |VideoFrameCallbackInterface| methods
-  // Method used by |MediaSourceImpl| to push video frames into
-  // |EncoderThread()|.
-  virtual int OnVideoFrameReceived(VideoFrame* ptr_frame);
+  // Method used by |MediaSourceImpl| to push video frames into encoding
+  // threads.
+  int OnVideoFrameReceived(VideoFrame* ptr_frame) override;
 
  private:
   // Function pointer type used for indirect access to the encoder loop
diff --git a/encoder/win/audio_sink_filter.cc b/encoder/win/audio_sink_filter.cc
index 5143089..81e02c9 100644
--- a/encoder/win/audio_sink_filter.cc
+++ b/encoder/win/audio_sink_filter.cc
@@ -296,9 +296,8 @@
       << "   duration= "      << duration << "\n"
       << "   size=" << sample_buffer_.buffer_length();
 
-  status = ptr_samples_callback_->OnSamplesReceived(&sample_buffer_);
-  if (status) {
-    LOG(ERROR) << "OnSamplesReceived failed, status=" << status;
+  if (!ptr_samples_callback_->OnSamplesReceived(&sample_buffer_)) {
+    LOG(ERROR) << "OnSamplesReceived failed.";
   }
   return S_OK;
 }