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

Unified Diff: webrtc/modules/video_coding/main/source/generic_encoder.cc

Issue 1406903002: Expose codec implementation names in stats. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/video_coding/main/source/generic_encoder.cc
diff --git a/webrtc/modules/video_coding/main/source/generic_encoder.cc b/webrtc/modules/video_coding/main/source/generic_encoder.cc
index 31c3f1715f8d585b1141d182dde1e9f2c739faf9..d319dbaea37b825d1fe78e572f9ca315609df0d2 100644
--- a/webrtc/modules/video_coding/main/source/generic_encoder.cc
+++ b/webrtc/modules/video_coding/main/source/generic_encoder.cc
@@ -155,6 +155,12 @@ int32_t VCMGenericEncoder::Encode(const VideoFrame& inputFrame,
int32_t result =
encoder_->Encode(inputFrame, codecSpecificInfo, &video_frame_types);
+
+ if (vcm_encoded_frame_callback_) {
+ vcm_encoded_frame_callback_->LastEncoderImplementationUsed(
+ encoder_->ImplementationName());
+ }
+
if (is_screenshare_ &&
result == WEBRTC_VIDEO_CODEC_TARGET_BITRATE_OVERSHOOT) {
// Target bitrate exceeded, encoder state has been reset - try again.
@@ -291,10 +297,13 @@ VCMEncodedFrameCallback::SetTransportCallback(VCMPacketizationCallback* transpor
}
int32_t VCMEncodedFrameCallback::Encoded(
- const EncodedImage& encodedImage,
+ const EncodedImage& encoded_image,
const CodecSpecificInfo* codecSpecificInfo,
const RTPFragmentationHeader* fragmentationHeader) {
- post_encode_callback_->Encoded(encodedImage, NULL, NULL);
+ // TODO(pbos): Investigate thread safety, this Encoded callback doesn't have
+ // to be on the same thread as ::Encode or SetTransportCallback. This is
+ // especially the case on hardware encoders.
+ post_encode_callback_->Encoded(encoded_image, NULL, NULL);
if (_sendCallback == NULL) {
return VCM_UNINITIALIZED;
@@ -302,7 +311,7 @@ int32_t VCMEncodedFrameCallback::Encoded(
#ifdef DEBUG_ENCODER_BIT_STREAM
if (_bitStreamAfterEncoder != NULL) {
- fwrite(encodedImage._buffer, 1, encodedImage._length,
+ fwrite(encoded_image._buffer, 1, encoded_image._length,
_bitStreamAfterEncoder);
}
#endif
@@ -316,24 +325,28 @@ int32_t VCMEncodedFrameCallback::Encoded(
rtpVideoHeader.rotation = _rotation;
int32_t callbackReturn = _sendCallback->SendData(
- _payloadType, encodedImage, *fragmentationHeader, rtpVideoHeaderPtr);
+ _payloadType, encoded_image, *fragmentationHeader, rtpVideoHeaderPtr);
if (callbackReturn < 0) {
return callbackReturn;
}
if (_mediaOpt != NULL) {
- _mediaOpt->UpdateWithEncodedData(encodedImage);
+ _mediaOpt->UpdateWithEncodedData(encoded_image);
if (_internalSource)
return _mediaOpt->DropFrame(); // Signal to encoder to drop next frame.
}
return VCM_OK;
}
-void
-VCMEncodedFrameCallback::SetMediaOpt(
- media_optimization::MediaOptimization *mediaOpt)
-{
- _mediaOpt = mediaOpt;
+void VCMEncodedFrameCallback::SetMediaOpt(
+ media_optimization::MediaOptimization* mediaOpt) {
+ _mediaOpt = mediaOpt;
+}
+
+void VCMEncodedFrameCallback::LastEncoderImplementationUsed(
+ const char* implementation_name) {
+ if (_sendCallback)
+ _sendCallback->OnEncoderImplementationName(implementation_name);
stefan-webrtc 2015/10/16 07:47:03 feel free to fix _sendCallback -> send_callback_
pbos-webrtc 2015/10/16 13:12:05 Done.
}
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698