get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/809068/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 809068,
    "url": "http://patchwork.ozlabs.org/api/patches/809068/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/openbsc/patch/20170902143009.14011-1-axilirator@gmail.com/",
    "project": {
        "id": 39,
        "url": "http://patchwork.ozlabs.org/api/projects/39/?format=api",
        "name": "OpenBSC development",
        "link_name": "openbsc",
        "list_id": "openbsc.lists.osmocom.org",
        "list_email": "openbsc@lists.osmocom.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170902143009.14011-1-axilirator@gmail.com>",
    "list_archive_url": null,
    "date": "2017-09-02T14:30:09",
    "name": "[1/2] pq_alsa.c: handle output buffer underrun",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "146f1a9891bf793d2ea64c1b9ee4d36f672c0d18",
    "submitter": {
        "id": 67986,
        "url": "http://patchwork.ozlabs.org/api/people/67986/?format=api",
        "name": "Vadim Yanitskiy",
        "email": "axilirator@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/openbsc/patch/20170902143009.14011-1-axilirator@gmail.com/mbox/",
    "series": [
        {
            "id": 1155,
            "url": "http://patchwork.ozlabs.org/api/series/1155/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/openbsc/list/?series=1155",
            "date": "2017-09-02T14:30:09",
            "name": "[1/2] pq_alsa.c: handle output buffer underrun",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/1155/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/809068/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/809068/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<openbsc-bounces@lists.osmocom.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "openbsc@lists.osmocom.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "openbsc@lists.osmocom.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=lists.osmocom.org\n\t(client-ip=144.76.43.76; helo=lists.osmocom.org;\n\tenvelope-from=openbsc-bounces@lists.osmocom.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"PzCzx9VW\"; dkim-atps=neutral",
            "lists.osmocom.org; dmarc=none header.from=gmail.com",
            "lists.osmocom.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com header.b=PzCzx9VW",
            "lists.osmocom.org; dmarc=pass header.from=gmail.com"
        ],
        "Received": [
            "from lists.osmocom.org (lists.osmocom.org [144.76.43.76])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkz7P4Ksgz9sNr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun,  3 Sep 2017 00:31:10 +1000 (AEST)",
            "from lists.osmocom.org (lists.osmocom.org [144.76.43.76])\n\tby lists.osmocom.org (Postfix) with ESMTP id 6090A38D65;\n\tSat,  2 Sep 2017 14:30:47 +0000 (UTC)",
            "from mail-lf0-x243.google.com (mail-lf0-x243.google.com\n\t[IPv6:2a00:1450:4010:c07::243])\n\tby lists.osmocom.org (Postfix) with ESMTP id 2E1BF38D54\n\tfor <openbsc@lists.osmocom.org>; Sat,  2 Sep 2017 14:30:39 +0000 (UTC)",
            "by mail-lf0-x243.google.com with SMTP id o124so1491723lfo.1\n\tfor <openbsc@lists.osmocom.org>; Sat, 02 Sep 2017 07:30:39 -0700 (PDT)",
            "from DELL.lan ([92.127.181.248]) by smtp.gmail.com with ESMTPSA id\n\tn76sm208435lje.62.2017.09.02.07.30.34\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tSat, 02 Sep 2017 07:30:35 -0700 (PDT)"
        ],
        "Received-SPF": "Pass (sender SPF authorized) identity=mailfrom;\n\tclient-ip=2a00:1450:4010:c07::243; helo=mail-lf0-x243.google.com;\n\tenvelope-from=axilirator@gmail.com;\n\treceiver=openbsc@lists.osmocom.org ",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id;\n\tbh=G5rmXRj2X1Zl9PMONzVDY/eoNfBM1SKeaS/Oo5ACAhE=;\n\tb=PzCzx9VWHxiz0ySPvo/BgAzU/RHwjzRntiFbo55QVp5qwkHuib99CfI8JN4d1EMyh4\n\txGImc5o59qK5gsxbhcljLF9qEHywrMVgaTM4/nEEpsae/yP97S8KtbLfY6xWgyWN7jeo\n\to9DEnwLljhSGHsiaR9tMqX6JzLR6N6HT/FzoZXdzmbeacat+ani0RX/hUpBsp3VCzMv/\n\tsX7CZalobMlN8KL4QtULpQXqTlJZF/T9jVQyEmGS0LoOfHap68zD8hmolodRbs0tFOio\n\tYM1k/nCrytjvqdVAJncY8n3krIYRgJVTkVWH8X3O36toq+mo9bVKr2lJurMUgDCcL9PL\n\tj7+A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=G5rmXRj2X1Zl9PMONzVDY/eoNfBM1SKeaS/Oo5ACAhE=;\n\tb=Lsn6caj4HtwENQYRE9Uax7DuDDpRUCFIRdE2PM6vAARBjVD9N9Z0Q/j/+deDjCpgpj\n\tx/WLo0Ewh3O4PY/15RqATIb5DXg+dUA0aVGrwhzQBdtFoCvQOKa+H/MuwwF/SKfcy2f/\n\tl9Kv1ziEx315q29vILx9uCzd3Cyd4Qkts1wWxFIeGARhrOcssV1E5/dgl1K4xLpdxUVe\n\tPtYia8N+YBSE5SMKXso5zE3GDbnmhFkY6VZSRn6FDzVJBvTMCV2/AidD5Es2KR0//VHn\n\tHm/ytRekwNHw4V96kFQOztfTPYTssDNmFH1MblS0twUVPfbAIZkmNpR7SEP0hbEV8B4q\n\t/OZQ==",
        "X-Gm-Message-State": "AHPjjUg4o4lLgYobWzEid58zqAcIcqanoPoiFCtS9bLXljbzuWv7dvw4\n\tjMF7wsiPeBgG+gomhx4=",
        "X-Google-Smtp-Source": "ADKCNb4evSSzxX6uGfiksx1VOaUWzvynytL3ya3PREb9tXRhOr/WbZZo9BctfVlDJizIEnB3G5PYjw==",
        "X-Received": "by 10.46.82.25 with SMTP id g25mr1135500ljb.25.1504362636455;\n\tSat, 02 Sep 2017 07:30:36 -0700 (PDT)",
        "From": "Vadim Yanitskiy <axilirator@gmail.com>",
        "To": "openbsc@lists.osmocom.org",
        "Subject": "[PATCH 1/2] pq_alsa.c: handle output buffer underrun",
        "Date": "Sat,  2 Sep 2017 21:30:09 +0700",
        "Message-Id": "<20170902143009.14011-1-axilirator@gmail.com>",
        "X-Mailer": "git-send-email 2.14.1",
        "X-BeenThere": "openbsc@lists.osmocom.org",
        "X-Mailman-Version": "2.1.23",
        "Precedence": "list",
        "List-Id": "\"Development of OpenBSC, OsmoBSC, OsmoNITB,\n\tOsmoCSCN\" <openbsc.lists.osmocom.org>",
        "List-Unsubscribe": "<https://lists.osmocom.org/mailman/options/openbsc>,\n\t<mailto:openbsc-request@lists.osmocom.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osmocom.org/pipermail/openbsc/>",
        "List-Post": "<mailto:openbsc@lists.osmocom.org>",
        "List-Help": "<mailto:openbsc-request@lists.osmocom.org?subject=help>",
        "List-Subscribe": "<https://lists.osmocom.org/mailman/listinfo/openbsc>,\n\t<mailto:openbsc-request@lists.osmocom.org?subject=subscribe>",
        "Cc": "axilirator@gmail.com",
        "Errors-To": "openbsc-bounces@lists.osmocom.org",
        "Sender": "\"OpenBSC\" <openbsc-bounces@lists.osmocom.org>"
    },
    "content": "On some systems the ALSA output buffer is pretty big, and\nif the audio samples are not being passed into the buffer\nquickly enough, it becomes starved for data, resulting\nin an error called underrun.\n\nPreviously, when it happenned, GAPK used to stop processing\nwith the following message (where X is a random number):\n\n[+] PQ: Adding ALSA output (dev='default', blk_len=320)\n[!] pq_execute(): abort, item returned -1\n[+] Processed X frames\n\nAccording to the ALSA documentation, the pcm_handle\nchanges its state when the problem happens, and should\nbe recovered using the snd_pcm_prepare() call. This change\nactually does that.\n---\n src/pq_alsa.c | 8 ++++++++\n 1 file changed, 8 insertions(+)",
    "diff": "diff --git a/src/pq_alsa.c b/src/pq_alsa.c\nindex 9cee426..a3435dd 100644\n--- a/src/pq_alsa.c\n+++ b/src/pq_alsa.c\n@@ -57,7 +57,15 @@ pq_cb_alsa_output(void *_state, uint8_t *out, const uint8_t *in, unsigned int in\n \tstruct pq_state_alsa *state = _state;\n \tunsigned int num_samples = in_len/2;\n \tint rv;\n+\n \trv = snd_pcm_writei(state->pcm_handle, in, num_samples);\n+\tif (rv == -EPIPE) {\n+\t\t/* Recover from buffer underrun */\n+\t\tsnd_pcm_prepare(state->pcm_handle);\n+\t\t/* Send a new sample again */\n+\t\trv = snd_pcm_writei(state->pcm_handle, in, num_samples);\n+\t}\n+\n \treturn rv == num_samples ? 0 : -1;\n }\n \n-- \n2.14.1\n\n\nFrom 8f1b0a9bf966cd561b10d2d33c6a47dd02e17dcf Mon Sep 17 00:00:00 2001\nFrom: Vadim Yanitskiy <axilirator@gmail.com>\nDate: Sat, 2 Sep 2017 18:02:45 +0700\nSubject: [PATCH 2/2] pq_alsa.c: print error message if device init fails\nTo: openbsc@lists.osmocom.org\nCc: 246tnt@gmail.com,\n    laforge@gnumonks.org,\n    axilirator@gmail.com\n\n---\n src/pq_alsa.c | 12 +++++++++---\n 1 file changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/src/pq_alsa.c b/src/pq_alsa.c\nindex a3435dd..cad76ca 100644\n--- a/src/pq_alsa.c\n+++ b/src/pq_alsa.c\n@@ -85,13 +85,16 @@ pq_queue_alsa_op(struct pq *pq, const char *alsa_dev, unsigned int blk_len, int\n \tint rc = -1;\n \n \tstate = calloc(1, sizeof(struct pq_state_alsa));\n-\tif (!state)\n-\t\treturn -ENOMEM;\n+\tif (!state) {\n+\t\trc = -ENOMEM;\n+\t\tgoto out_print;\n+\t}\n \n \trc = snd_pcm_open(&state->pcm_handle, alsa_dev,\n \t\t\t  in_out_n ? SND_PCM_STREAM_CAPTURE : SND_PCM_STREAM_PLAYBACK, 0);\n \tif (rc < 0)\n-\t\treturn rc;\n+\t\tgoto out_print;\n+\n \tstate->blk_len = blk_len;\n \n \trc = snd_pcm_hw_params_malloc(&hw_params);\n@@ -143,6 +146,9 @@ out_free_par:\n out_close:\n \tsnd_pcm_close(state->pcm_handle);\n \tfree(state);\n+out_print:\n+\tfprintf(stderr, \"[!] Couldn't init ALSA device '%s': %s\\n\",\n+\t\talsa_dev, snd_strerror(rc));\n \treturn rc;\n }\n \n",
    "prefixes": [
        "1/2"
    ]
}