Adding more detail to MessageQueue::Dispatch logging.

Every message will now be traced with the location from which it was
posted, including function name, file and line number.

This CL also writes a normal LOG message when the dispatch took more
than a certain amount of time (currently 50ms).

This logging should help us identify messages that are taking
longer than expected to be dispatched.

R=pthatcher@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/2019423006 .

Cr-Commit-Position: refs/heads/master@{#13104}
diff --git a/webrtc/api/java/jni/androidmediaencoder_jni.cc b/webrtc/api/java/jni/androidmediaencoder_jni.cc
index 0e36aa1..a240b25 100644
--- a/webrtc/api/java/jni/androidmediaencoder_jni.cc
+++ b/webrtc/api/java/jni/androidmediaencoder_jni.cc
@@ -413,35 +413,33 @@
   }
 
   return codec_thread_->Invoke<int32_t>(
-      Bind(&MediaCodecVideoEncoder::InitEncodeOnCodecThread,
-           this,
-           init_width,
-           init_height,
-           codec_settings->startBitrate,
-           codec_settings->maxFramerate,
-           false /* use_surface */));
+      RTC_FROM_HERE,
+      Bind(&MediaCodecVideoEncoder::InitEncodeOnCodecThread, this, init_width,
+           init_height, codec_settings->startBitrate,
+           codec_settings->maxFramerate, false /* use_surface */));
 }
 
 int32_t MediaCodecVideoEncoder::Encode(
     const webrtc::VideoFrame& frame,
     const webrtc::CodecSpecificInfo* /* codec_specific_info */,
     const std::vector<webrtc::FrameType>* frame_types) {
-  return codec_thread_->Invoke<int32_t>(Bind(
-      &MediaCodecVideoEncoder::EncodeOnCodecThread, this, frame, frame_types));
+  return codec_thread_->Invoke<int32_t>(
+      RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::EncodeOnCodecThread, this,
+                          frame, frame_types));
 }
 
 int32_t MediaCodecVideoEncoder::RegisterEncodeCompleteCallback(
     webrtc::EncodedImageCallback* callback) {
   return codec_thread_->Invoke<int32_t>(
+      RTC_FROM_HERE,
       Bind(&MediaCodecVideoEncoder::RegisterEncodeCompleteCallbackOnCodecThread,
-           this,
-           callback));
+           this, callback));
 }
 
 int32_t MediaCodecVideoEncoder::Release() {
   ALOGD << "EncoderRelease request";
   return codec_thread_->Invoke<int32_t>(
-      Bind(&MediaCodecVideoEncoder::ReleaseOnCodecThread, this));
+      RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::ReleaseOnCodecThread, this));
 }
 
 int32_t MediaCodecVideoEncoder::SetChannelParameters(uint32_t /* packet_loss */,
@@ -452,10 +450,8 @@
 int32_t MediaCodecVideoEncoder::SetRates(uint32_t new_bit_rate,
                                          uint32_t frame_rate) {
   return codec_thread_->Invoke<int32_t>(
-      Bind(&MediaCodecVideoEncoder::SetRatesOnCodecThread,
-           this,
-           new_bit_rate,
-           frame_rate));
+      RTC_FROM_HERE, Bind(&MediaCodecVideoEncoder::SetRatesOnCodecThread, this,
+                          new_bit_rate, frame_rate));
 }
 
 void MediaCodecVideoEncoder::OnMessage(rtc::Message* msg) {
@@ -478,7 +474,7 @@
 
   // If there aren't more frames to deliver, we can stop the loop
   if (!input_frame_infos_.empty()) {
-    codec_thread_->PostDelayed(kMediaCodecPollMs, this);
+    codec_thread_->PostDelayed(RTC_FROM_HERE, kMediaCodecPollMs, this);
   } else {
     output_delivery_loop_running_ = false;
   }
@@ -742,7 +738,7 @@
 
   if (!output_delivery_loop_running_) {
     output_delivery_loop_running_ = true;
-    codec_thread_->PostDelayed(kMediaCodecPollMs, this);
+    codec_thread_->PostDelayed(RTC_FROM_HERE, kMediaCodecPollMs, this);
   }
 
   if (!DeliverPendingOutputs(jni)) {
@@ -1178,6 +1174,7 @@
   // directly.
   RTC_DCHECK(!codec_thread_checker_.CalledOnValidThread());
   codec_thread_->Invoke<void>(
+      RTC_FROM_HERE,
       Bind(&MediaCodecVideoEncoder::OnDroppedFrameOnCodecThread, this));
 }