After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 681111 - Bad librtmp return value treatment
Bad librtmp return value treatment
Status: RESOLVED DUPLICATE of bug 686009
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-03 08:31 UTC by David Régade
Modified: 2012-10-12 22:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rtmpsink librtmp return value (465 bytes, patch)
2012-08-03 08:31 UTC, David Régade
none Details | Review

Description David Régade 2012-08-03 08:31:29 UTC
Created attachment 220208 [details] [review]
rtmpsink librtmp return value

In ext/rtmp/gstrtmpsink.c around line 244:

  if (!RTMP_Write (sink->rtmp, (char *) map.data, map.size))
    goto write_failed;


But RTMP_Write may return:
- 0 if packet is to small
- FALSE (0) on memory allocation error
- -1 if a packet failed to be sent
- bytes sent in all other cases

So -1 must be considered as an error and previous return value test should be:

  if (0 >= RTMP_Write (sink->rtmp, (char *) map.data, map.size))
    goto write_failed;

I attached a patch against commit:
955e50449e471e8431664f5f8db304ffeb79ae16
Comment 1 Tim-Philipp Müller 2012-08-03 19:39:53 UTC
Out of curiosity - what did this fix for you exactly? Did it loop endlessly while not actually sending any packets? Should -1 be fatal or could it be a temporary issue?
Comment 2 David Régade 2012-08-03 21:21:28 UTC
I use gstreamer+rtmpsink over an unstable dsl line. When the line disconnects and reconnects my software doesn't report any problem and the pipeline is still in PLAYING state without any message/event.
No message is sent because -1 is returned and not considered as an error. 
RTMP_Write returns -1 when send() return -1. From my point of view -1 should be fatal.

But I'm not sure 0 should be considered as an error, curl only returns an error if RTMP_Write return -1:

static ssize_t rtmp_send(struct connectdata *conn, int sockindex,
                         const void *buf, size_t len, CURLcode *err)
{
  RTMP *r = conn->proto.generic;
  ssize_t num;

  (void)sockindex; /* unused */

  num = RTMP_Write(r, (char *)buf, len);
  if(num < 0)
    *err = CURLE_SEND_ERROR;

  return num;
}
Comment 3 Tim-Philipp Müller 2012-10-12 22:40:05 UTC
Alright, thanks for the explanation. This should be fixed now in git. Sorry I took the other person's patch, because it was already in git format-patch format, which makes things easier to me, and it also puts the <= 0 to the right which is more in line with existing GStreamer style. Hope you don't mind too much.

*** This bug has been marked as a duplicate of bug 686009 ***